Revision 249
Added by stefan almost 19 years ago
trunk/wb/install/save.php | ||
---|---|---|
74 | 74 |
} |
75 | 75 |
} |
76 | 76 |
|
77 |
// Dummy class to allow modules' install scripts to call $admin->print_error |
|
78 |
class admin_dummy |
|
79 |
{ |
|
80 |
var $error=''; |
|
81 |
function print_error($message) |
|
82 |
{ |
|
83 |
$this->error=$message; |
|
84 |
} |
|
85 |
} |
|
86 |
|
|
77 | 87 |
// Function to workout what the default permissions are for files created by the webserver |
78 | 88 |
function default_file_mode($temp_dir) { |
79 | 89 |
$v = explode(".",PHP_VERSION); |
... | ... | |
564 | 574 |
$database->query("INSERT INTO `".TABLE_PREFIX."search` (name) VALUES ('template')"); |
565 | 575 |
|
566 | 576 |
require_once(WB_PATH.'/framework/initialize.php'); |
567 |
// $admin = new admin('dummy'); |
|
568 | 577 |
|
569 | 578 |
// Include the PclZip class file (thanks to |
570 | 579 |
require_once(WB_PATH.'/include/pclzip/pclzip.lib.php'); |
... | ... | |
582 | 591 |
// Unpack pre-packaged languages |
583 | 592 |
|
584 | 593 |
} |
594 |
|
|
595 |
$admin=new admin_dummy(); |
|
585 | 596 |
// Load addons into DB |
586 | 597 |
$dirs['modules'] = WB_PATH.'/modules/'; |
587 | 598 |
$dirs['templates'] = WB_PATH.'/templates/'; |
... | ... | |
593 | 604 |
// Get addon type |
594 | 605 |
if($type == 'modules') { |
595 | 606 |
load_module($dir.'/'.$file, true); |
607 |
// Pretty ugly hack to let modules run $admin->set_error |
|
608 |
// See dummy class definition admin_dummy above |
|
609 |
if ($admin->error!='') { |
|
610 |
set_error($admin->error); |
|
611 |
} |
|
596 | 612 |
} elseif($type == 'templates') { |
597 | 613 |
load_template($dir.'/'.$file); |
598 | 614 |
} elseif($type == 'languages') { |
trunk/wb/framework/functions.php | ||
---|---|---|
680 | 680 |
|
681 | 681 |
// Load module into DB |
682 | 682 |
function load_module($directory, $install = false) { |
683 |
global $database; |
|
683 |
global $database,$admin,$MESSAGE;
|
|
684 | 684 |
if(file_exists($directory.'/info.php')) { |
685 | 685 |
require($directory.'/info.php'); |
686 | 686 |
if(isset($module_name)) { |
Also available in: Unified diff
Fixed a problem with the install script that occur when non-stock modules are already present and use $admin->print_error().