本文整理汇总了PHP中Modules::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Modules::update方法的具体用法?PHP Modules::update怎么用?PHP Modules::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Modules
的用法示例。
在下文中一共展示了Modules::update方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall
public function uninstall()
{
$mod = new Modules();
$mod->getModuleByName('blog');
// remove perms
FabriqModules::remove_perms($mod->id);
// remove paths
$pathmap =& FabriqModules::module('pathmap');
$pathmap->remove_path('blog');
$pathmap->remove_path('blog/create');
$pathmap->remove_path('blog/update/!#');
$pathmap->remove_path('blog/destroy/!#');
$pathmap->remove_path('blog/show/!#');
// delete database table
global $db;
$sql = "DROP TABLE `fabmod_blog_blogs`;";
$db->query($sql);
// uninstall any terms
if (FabriqModules::enabled('taxonomy')) {
FabriqModules::module('taxonomy')->uninstallMaps('fabmod_blog_blogs');
}
// set module as not installed
$mod->installed = 0;
$mod->update();
}
示例2: install
public function install()
{
$mod = new Modules();
$mod->getModuleByName('roles');
$perms = array('create roles', 'update roles', 'delete roles', 'manage roles');
$perm_ids = FabriqModules::register_perms($mod->id, $perms);
global $db;
$sql = "CREATE TABLE IF NOT EXISTS `fabmod_roles_roles` (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`role` VARCHAR(100) NOT NULL,\n\t\t\t`enabled` TINYINT(1) NOT NULL DEFAULT 1,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`)\n\t\t) ENGINE=INNODB;";
$db->query($sql);
$sql = "CREATE TABLE IF NOT EXISTS `fabmod_roles_moduleperms` (\n\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`permission` INT(11) NOT NULL,\n\t\t\t`role` INT(11) NOT NULL,\n\t\t\t`created` DATETIME NOT NULL,\n\t\t\t`updated` DATETIME NOT NULL,\n\t\t\tPRIMARY KEY (`id`),\n\t\t\tCONSTRAINT `fk_moduleperms_permission` FOREIGN KEY (`permission`) REFERENCES fabmods_perms(id) ON DELETE CASCADE,\n\t\t\tCONSTRAINT `fk_moduleperms_role` FOREIGN KEY (`role`) REFERENCES fabmod_roles_roles(id) ON DELETE CASCADE\n\t\t) ENGINE=INNODB;";
$db->query($sql);
// create base roles
$role = FabriqModules::new_model('roles', 'Roles');
$role->role = "unauthenticated";
$role->enabled = 1;
$role->id = $role->create();
$role = FabriqModules::new_model('roles', 'Roles');
$role->role = "authenticated";
$role->enabled = 1;
$role->id = $role->create();
$role = FabriqModules::new_model('roles', 'Roles');
$role->role = "administrator";
$role->enabled = 1;
$role->id = $role->create();
// map paths
$pathmap =& FabriqModules::module('pathmap');
$pathmap->register_path('fabriqadmin/roles/manage', 'roles', 'index', 'module');
$pathmap->register_path('fabriqadmin/roles/create', 'roles', 'create', 'module');
$pathmap->register_path('fabriqadmin/roles/perms', 'roles', 'perms', 'module');
// set module as installed
$mod->installed = 1;
$mod->update();
}
示例3: update_2_1_8
public function update_2_1_8()
{
// update the module version number
$mod = new Modules();
$mod->getModuleByName('users');
$mod->versioninstalled = '2.1.8';
$mod->update();
}
示例4: update_2_1_3
public function update_2_1_3()
{
// update the module version number
$mod = new Modules();
$mod->getModuleByName('pathmap');
$mod->versioninstalled = '2.1.3';
$mod->update();
}
示例5: update_1_5_1
public function update_1_5_1()
{
// update the module version number
$mod = new Modules();
$mod->getModuleByName('users');
$mod->versioninstalled = '1.5.1';
$mod->update();
}
示例6: uninstall
public function uninstall()
{
$mod = new Modules();
$mod->getModuleByName('googleanalytics');
// set module as not installed
$mod->installed = 0;
$mod->update();
}
示例7: update_2_3_1
public function update_2_3_1()
{
// update the path(s) for the fabriqupdate module to point to the proper actions
$pathmap =& FabriqModules::module('pathmap');
$pathmap->remove_path('fabriqupdates');
$pathmap->register_path('fabriqupdates', 'fabriqinstall', 'fetchUpdates', 'module');
// update the module version number
$mod = new Modules();
$mod->getModuleByName('fabriqinstall');
$mod->versioninstalled = '2.3.1';
$mod->update();
}
示例8: fabriqinstallReady
/**
* Check that the fabriqinstall module is installed
*/
public static function fabriqinstallReady()
{
// check that the fabriqinstall module is installed
if (!FabriqModules::installed('fabriqinstall')) {
FabriqModules::register_module('fabriqinstall');
FabriqModules::install('fabriqinstall');
$module = new Modules();
$module->getModuleByName('fabriqinstall');
$module->enabled = 1;
$module->update();
Messaging::message('Installed fabriqinstall module', 'success');
}
}
示例9: install_step3
//.........这里部分代码省略.........
$contFile = 'sites/' . FabriqStack::site() . "/app/controllers/homepage.controller.php";
if (!file_exists($contFile)) {
$fh = fopen($contFile, 'w');
fwrite($fh, "<?php\n");
fwrite($fh, "class homepage_controller extends Controller {\n");
fwrite($fh, "\tfunction index() {\n");
fwrite($fh, "\t\tFabriq::title('Welcome to {$siteConfig['title']}');\n");
fwrite($fh, "\t}\n");
fwrite($fh, "}\n");
fclose($fh);
}
// write default action if it doesn't already exist
// may already exist from being created in a dev environmentor this is
// a distributed web app
if (!is_dir('sites/' . FabriqStack::site() . "/app/views/homepage")) {
mkdir('sites/' . FabriqStack::site() . "/app/views/homepage");
}
$actionFile = 'sites/' . FabriqStack::site() . "/app/views/homepage/index.view.php";
if (!file_exists($actionFile)) {
$fh = fopen($actionFile, 'w');
fwrite($fh, "<h1>homepage#index</h1>\n");
fclose($fh);
}
// create the framework database tables
global $db;
$db_info = array('server' => trim($_POST['server']), 'user' => trim($_POST['user']), 'pwd' => trim($_POST['pwd']), 'db' => trim($_POST['db']));
$db = new Database($db_info);
// install config table
$query = "CREATE TABLE IF NOT EXISTS `fabriq_config` (\n\t\t\t\t\t\t`version` VARCHAR(10) NOT NULL,\n\t\t\t\t\t\t`installed` DATETIME NOT NULL,\n\t\t\t\t\t\tPRIMARY KEY (`version`)\n\t\t\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
$db->query($query);
$query = "INSERT INTO fabriq_config (version, installed) VALUES (?, ?)";
$db->prepare_cud($query, array($this->installVersion, date('Y-m-d H:i:s')));
// modules table
$query = "CREATE TABLE IF NOT EXISTS `fabmods_modules` (\n\t\t\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t`module` varchar(100) NOT NULL,\n\t\t\t\t\t\t`enabled` tinyint(4) NOT NULL,\n\t\t\t\t\t\t`hasconfigs` tinyint(1) NOT NULL,\n\t\t\t\t\t\t`installed` tinyint(1) NOT NULL,\n\t\t\t\t\t\t`versioninstalled` varchar(20) NOT NULL,\n\t\t\t\t\t\t`description` text NOT NULL,\n\t\t\t\t\t\t`dependson` text,\n\t\t\t\t\t\t`created` datetime NOT NULL,\n\t\t\t\t\t\t`updated` datetime NOT NULL,\n\t\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
$db->query($query);
// module configs table
$query = "CREATE TABLE IF NOT EXISTS `fabmods_module_configs` (\n\t\t\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t`module` int(11) NOT NULL,\n\t\t\t\t\t\t`var` varchar(100) NOT NULL,\n\t\t\t\t\t\t`val` text NOT NULL,\n\t\t\t\t\t\t`created` datetime NOT NULL,\n\t\t\t\t\t\t`updated` datetime NOT NULL,\n\t\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
$db->query($query);
// module perms table
$query = "CREATE TABLE IF NOT EXISTS `fabmods_perms` (\n\t\t\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t`permission` varchar(100) NOT NULL,\n\t\t\t\t\t\t`module` int(11) NOT NULL,\n\t\t\t\t\t\t`created` datetime NOT NULL,\n\t\t\t\t\t\t`updated` datetime NOT NULL,\n\t\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
$db->query($query);
// install the module events table
$query = "CREATE TABLE IF NOT EXISTS `fabmods_module_events` (\n\t\t\t\t\t`id` INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t`eventModule` VARCHAR(50) NOT NULL,\n\t\t\t\t\t`eventAction` VARCHAR(50) NOT NULL,\n\t\t\t\t\t`eventName` VARCHAR(100) NOT NULL,\n\t\t\t\t\t`handlerModule` VARCHAR(50) NOT NULL,\n\t\t\t\t\t`handlerAction` VARCHAR(50) NOT NULL,\n\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
$db->query($query);
if (!isset($_SESSION['FAB_INSTALL_mods_installed'])) {
Messaging::message('Configuration file has been written', 'success');
Messaging::message('Core database tables have been created', 'success');
FabriqModules::register_module('pathmap');
FabriqModules::register_module('roles');
FabriqModules::register_module('users');
FabriqModules::register_module('sitemenus');
FabriqModules::register_module('fabriqmodules');
FabriqModules::register_module('fabriqinstall');
FabriqModules::install('pathmap');
$module = new Modules();
$module->getModuleByName('pathmap');
$module->enabled = 1;
$module->update();
Messaging::message('Installed pathmap module', 'success');
FabriqModules::install('roles');
$module = new Modules();
$module->getModuleByName('roles');
$module->enabled = 1;
$module->update();
Messaging::message('Installed roles module', 'success');
FabriqModules::install('users');
示例10: uninstall
public function uninstall()
{
Fabriq::render('none');
header('Content-type:application/json');
if (FabriqModules::module('roles')->hasRole('administrator')) {
$module = new Modules(PathMap::arg(2));
if ($module->module != '') {
$module->installed = 0;
$module->update();
FabriqModules::uninstall($module->module);
echo json_encode(array('success' => true));
} else {
echo json_encode(array('success' => false));
}
} else {
echo json_encode(array('success' => false, 'notLoggedIn' => true));
}
}