本文整理汇总了PHP中ModuleManager::install方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleManager::install方法的具体用法?PHP ModuleManager::install怎么用?PHP ModuleManager::install使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleManager
的用法示例。
在下文中一共展示了ModuleManager::install方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defined
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
$modules = array('Apps_Forum', 'Apps_Gallery', 'Apps_StaticPage', 'Apps_TwisterGame', 'Base_ModuleManager', 'Libs_Lytebox', 'Tests_BookmarkBrowser', 'Utils_BookmarkBrowser', 'Tests_Lytebox', 'Tools_FontSize', 'Utils_Gallery', 'Utils_BookmarkBrowser');
foreach ($modules as $m) {
if (DB::GetOne('SELECT 1 FROM modules WHERE name=%s', array($m)) && !is_dir('modules/' . str_replace('_', '/', $m))) {
DB::Execute('DELETE FROM modules WHERE name=%s', array($m));
Base_ThemeCommon::uninstall_default_theme($m);
ModuleManager::remove_data_dir($m);
}
}
if (ModuleManager::is_installed('Utils_RecordBrowser_RecordPickerFS') < 0) {
ModuleManager::install('Utils_RecordBrowser_RecordPickerFS', 0, false);
}
if (ModuleManager::is_installed('Utils_RecordBrowser_RecordPicker') < 0) {
ModuleManager::install('Utils_RecordBrowser_RecordPicker');
}
示例2: defined
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
ModuleManager::install('Utils/FileStorage');
@PatchUtil::db_add_column('utils_attachment_file', 'filestorage_id', 'I8 NOTNULL');
Patch::set_message('Processing files');
$files_checkpoint = Patch::checkpoint('files');
if (!$files_checkpoint->is_done()) {
if ($files_checkpoint->has('files')) {
$files = $files_checkpoint->get('files');
} else {
$files = 0;
}
if ($files_checkpoint->has('files_qty')) {
$files_qty = $files_checkpoint->get('files_qty');
} else {
$files_qty = DB::GetOne('SELECT count(*) FROM utils_attachment_file');
$files_checkpoint->set('files_qty', $files_qty);
}
while ($ret = DB::SelectLimit('SELECT f.id,f.attach_id as aid,f.original FROM utils_attachment_file f ORDER BY f.id', 1, $files++)) {
$row = $ret->FetchRow();
if (!$row) {
break;
}
if (file_exists(DATA_DIR . '/Utils_Attachment/' . $row['aid'] . '/' . $row['id'])) {
Patch::set_message('Processing file: ' . $files . '/' . $files_qty);
$files_checkpoint->require_time(2);
$fsid = Utils_FileStorageCommon::write_file($row['original'], DATA_DIR . '/Utils_Attachment/' . $row['aid'] . '/' . $row['id'], 'attachment_file/' . $row['id']);
unlink(DATA_DIR . '/Utils_Attachment/' . $row['aid'] . '/' . $row['id']);
DB::Execute('UPDATE utils_attachment_file SET filestorage_id=%d WHERE id=%d', array($fsid, $row['id']));
}
示例3: defined
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
$module_name = 'Utils/QueryBuilder';
if (ModuleManager::is_installed($module_name) < 0) {
ModuleManager::install($module_name);
}
示例4: defined
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
if (ModuleManager::is_installed('Base_Cron') >= 0) {
return;
}
ModuleManager::install('Base_Cron');
示例5: validate
public function validate($data)
{
if (DEMO_MODE) {
print 'You cannot modify installed modules in demo';
return false;
}
@set_time_limit(0);
$installed = array();
$install = array();
$uninstall = array();
$anonymous_setup = false;
foreach ($data as $k => $v) {
${$k} = $v;
}
foreach ($installed as $name => $new_version) {
$old_version = ModuleManager::is_installed($name);
if ($old_version == $new_version) {
continue;
}
if ($old_version == -1 && $new_version >= 0) {
$install[$name] = $new_version;
continue;
}
if ($new_version == -2) {
$uninstall[$name] = 1;
$install[$name] = $old_version;
continue;
}
if ($old_version >= 0 && $new_version == -1) {
$uninstall[$name] = 1;
continue;
}
if ($old_version < $new_version) {
if (!ModuleManager::upgrade($name, $new_version)) {
return false;
}
continue;
}
if ($old_version > $new_version) {
if (!ModuleManager::downgrade($name, $new_version)) {
return false;
}
continue;
}
}
//uninstall
$modules_prio_rev = array();
foreach (ModuleManager::$modules as $k => $v) {
$modules_prio_rev[] = $k;
}
$modules_prio_rev = array_reverse($modules_prio_rev);
foreach ($modules_prio_rev as $k) {
if (array_key_exists($k, $uninstall)) {
if (!ModuleManager::uninstall($k)) {
return false;
}
if (count(ModuleManager::$modules) == 0) {
print 'No modules installed';
}
}
}
//install
foreach ($install as $i => $v) {
$post_install[$i] = $v;
if (isset($uninstall[$i])) {
if (!ModuleManager::install($i, $v, true, false)) {
return false;
}
} else {
if (!ModuleManager::install($i, $v)) {
return false;
}
}
}
$processed = ModuleManager::get_processed_modules();
$this->set_module_variable('post-install', $processed['install']);
Base_ThemeCommon::create_cache();
if (empty($post_install)) {
Epesi::redirect();
}
return true;
}
示例6: defined
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
$mod = 'Base/Print';
if (ModuleManager::is_installed($mod) < 0) {
// not installed
ModuleManager::install($mod, 0);
}
示例7: _install_module
public function _install_module($module)
{
$module = str_replace('/', '_', $module);
ModuleManager::install($module);
}
示例8: defined
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
//ModuleManager::uninstall($module_to_uninstall);
if (ModuleManager::is_installed('Base_EpesiStore') === -1) {
ModuleManager::install('Base_EpesiStore');
ModuleManager::create_load_priority_array();
} else {
PatchUtil::db_alter_column('epesi_store_modules', 'version', 'C(10)');
}
示例9: defined
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
ModuleManager::install('Utils_FrontPage');
示例10: done
public function done($d)
{
@set_time_limit(0);
if (count($this->ini) == 1) {
$pkgs = reset($this->ini);
$pkgs = $pkgs['package'];
} else {
$pkgs = isset($this->ini[$d[0]['setup_type']]['package']) ? $this->ini[$d[0]['setup_type']]['package'] : array();
}
$t = microtime(true);
error_log(date('Y-m-d H:i:s') . ': installing "Base" ...' . "\n", 3, DATA_DIR . '/firstrun.log');
if (!ModuleManager::install('Base', null, false)) {
print 'Unable to install Base module pack.';
return false;
}
error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
$t = microtime(true);
error_log(date('Y-m-d H:i:s') . ': creating admin user ...' . "\n", 3, DATA_DIR . '/firstrun.log');
if (!Base_UserCommon::add_user($d['simple_user']['login'])) {
print 'Unable to create user';
return false;
}
$user_id = Base_UserCommon::get_user_id($d['simple_user']['login']);
if ($user_id === false) {
print 'Unable to get admin user id';
return false;
}
if (!DB::Execute('INSERT INTO user_password(user_login_id,password,mail) VALUES(%d,%s, %s)', array($user_id, md5($d['simple_user']['pass']), $d['simple_user']['mail']))) {
print 'Unable to set user password';
return false;
}
if (!Base_UserCommon::change_admin($user_id, 2)) {
print 'Unable to update admin account data (groups).';
return false;
}
Acl::set_user($user_id, true);
Variable::set('anonymous_setup', false);
error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
$t = microtime(true);
error_log(date('Y-m-d H:i:s') . ': setting mail server ...' . "\n", 3, DATA_DIR . '/firstrun.log');
$method = $d['simple_mail']['mail_method'];
Variable::set('mail_method', $method);
Variable::set('mail_from_addr', $d['simple_user']['mail']);
Variable::set('mail_from_name', $d['simple_user']['login']);
if ($method == 'smtp') {
Variable::set('mail_host', $d['simple_mail_smtp']['mail_host']);
if ($d['simple_mail_smtp']['mail_user'] !== '' && $d['simple_mail_smtp']['mail_user'] !== '') {
$auth = true;
} else {
$auth = false;
}
Variable::set('mail_auth', $auth);
if ($auth) {
Variable::set('mail_user', $d['simple_mail_smtp']['mail_user']);
Variable::set('mail_password', $d['simple_mail_smtp']['mail_password']);
}
}
error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
$t = microtime(true);
error_log(date('Y-m-d H:i:s') . ': Installing modules ...' . "\n", 3, DATA_DIR . '/firstrun.log');
foreach ($pkgs as $p) {
if (!is_dir('modules/' . $p)) {
continue;
}
$t2 = microtime(true);
error_log(' * ' . date('Y-m-d H:i:s') . ' - ' . $p . ' (', 3, DATA_DIR . '/firstrun.log');
if (!ModuleManager::install(str_replace('/', '_', $p), null, false)) {
print '<b>Unable to install ' . str_replace('_', '/', $p) . ' module.</b>';
}
error_log(microtime(true) - $t2 . "s)\n", 3, DATA_DIR . '/firstrun.log');
}
error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
$t = microtime(true);
error_log(date('Y-m-d H:i:s') . ': Refreshing cache of modules ...' . "\n", 3, DATA_DIR . '/firstrun.log');
ModuleManager::create_load_priority_array();
Base_SetupCommon::refresh_available_modules();
error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
$t = microtime(true);
error_log(date('Y-m-d H:i:s') . ': Creating cache of template files ...' . "\n", 3, DATA_DIR . '/firstrun.log');
Base_ThemeCommon::create_cache();
error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
$t = microtime(true);
error_log(date('Y-m-d H:i:s') . ': Updating translation files ...' . "\n", 3, DATA_DIR . '/firstrun.log');
Base_LangCommon::update_translations();
error_log(date('Y-m-d H:i:s') . ': done (' . (microtime(true) - $t) . "s).\n", 3, DATA_DIR . '/firstrun.log');
$processed = ModuleManager::get_processed_modules();
$_SESSION['first-run_post-install'] = $processed['install'];
location();
}
示例11: check_firstrun
private static function check_firstrun()
{
$first_run = false;
foreach (ModuleManager::$modules as $name => $version) {
if ($name == FIRST_RUN) {
$first_run = true;
}
}
ob_start();
if (!$first_run) {
if (ModuleManager::install(FIRST_RUN)) {
$processed_modules = ModuleManager::get_processed_modules();
$_SESSION['first-run_post-install'] = $processed_modules['install'];
} else {
$x = ob_get_contents();
ob_end_clean();
trigger_error('Unable to install default module: ' . $x, E_USER_ERROR);
}
}
ob_end_clean();
}