本文整理汇总了PHP中module::_remove_from_path方法的典型用法代码示例。如果您正苦于以下问题:PHP module::_remove_from_path方法的具体用法?PHP module::_remove_from_path怎么用?PHP module::_remove_from_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module
的用法示例。
在下文中一共展示了module::_remove_from_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
/**
* Install a module. This will call <module>_installer::install(), which is responsible for
* creating database tables, setting module variables and calling module::set_version().
* Note that after installing, the module must be activated before it is available for use.
* @param string $module_name
*/
static function install($module_name)
{
module::_add_to_path($module_name);
$installer_class = "{$module_name}_installer";
if (class_exists($installer_class) && method_exists($installer_class, "install")) {
call_user_func_array(array($installer_class, "install"), array());
}
module::set_version($module_name, module::available()->{$module_name}->code_version);
// Set the weight of the new module, which controls the order in which the modules are
// loaded. By default, new modules are installed at the end of the priority list. Since the
// id field is monotonically increasing, the easiest way to guarantee that is to set the weight
// the same as the id. We don't know that until we save it for the first time
$module = ORM::factory("module")->where("name", "=", $module_name)->find();
if ($module->loaded()) {
$module->weight = $module->id;
$module->save();
}
module::load_modules();
// Now the module is installed but inactive, so don't leave it in the active path
module::_remove_from_path($module_name);
log::success("module", t("Installed module %module_name", array("module_name" => $module_name)));
}
示例2: install
/**
* Install a module. This will call <module>_installer::install(), which is responsible for
* creating database tables, setting module variables and calling module::set_version().
* Note that after installing, the module must be activated before it is available for use.
* @param string $module_name
*/
static function install($module_name)
{
module::_add_to_path($module_name);
$installer_class = "{$module_name}_installer";
if (method_exists($installer_class, "install")) {
call_user_func_array(array($installer_class, "install"), array());
} else {
module::set_version($module_name, 1);
}
module::load_modules();
// Now the module is installed but inactive, so don't leave it in the active path
module::_remove_from_path($module_name);
log::success("module", t("Installed module %module_name", array("module_name" => $module_name)));
}