当前位置: 首页>>代码示例>>PHP>>正文


PHP DevblocksPlatform::clearCache方法代码示例

本文整理汇总了PHP中DevblocksPlatform::clearCache方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::clearCache方法的具体用法?PHP DevblocksPlatform::clearCache怎么用?PHP DevblocksPlatform::clearCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DevblocksPlatform的用法示例。


在下文中一共展示了DevblocksPlatform::clearCache方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleRequest

 function handleRequest(DevblocksHttpRequest $request)
 {
     @set_time_limit(0);
     // no timelimit (when possible)
     DevblocksPlatform::clearCache();
     $stack = $request->path;
     array_shift($stack);
     // update
     switch (array_shift($stack)) {
         case 'locked':
             if (!DevblocksPlatform::versionConsistencyCheck()) {
                 $url = DevblocksPlatform::getUrlService();
                 echo "<h1>PortSensor Portal</h1>";
                 echo "The application is currently waiting for an administrator to finish upgrading. " . "Please wait a few minutes and then " . sprintf("<a href='%s'>try again</a>.<br><br>", $url->write('c=update&a=locked'));
                 echo sprintf("If you're an admin you may <a href='%s'>finish the upgrade</a>.", $url->write('c=update'));
             } else {
                 DevblocksPlatform::redirect(new DevblocksHttpResponse(array('home')));
             }
             break;
         default:
             $path = DEVBLOCKS_PATH . 'tmp' . DIRECTORY_SEPARATOR;
             $file = $path . 'psupdate_lock';
             if (!file_exists($file) || @filectime($file) + 600 < time()) {
                 // 10 min lock
                 touch($file);
                 //				    $settings = CerberusSettings::getInstance();
                 //				    $authorized_ips_str = $settings->get(CerberusSettings::AUTHORIZED_IPS);
                 //				    $authorized_ips = CerberusApplication::parseCrlfString($authorized_ips_str);
                 //
                 //			   	    $authorized_ip_defaults = CerberusApplication::parseCsvString(AUTHORIZED_IPS_DEFAULTS);
                 //				    $authorized_ips = array_merge($authorized_ips, $authorized_ip_defaults);
                 //
                 //				    $pass = false;
                 //					foreach ($authorized_ips as $ip)
                 //					{
                 //						if(substr($ip,0,strlen($ip)) == substr($_SERVER['REMOTE_ADDR'],0,strlen($ip)))
                 //					 	{ $pass=true; break; }
                 //					}
                 $pass = true;
                 if (!$pass) {
                     echo 'Your IP address (' . $_SERVER['REMOTE_ADDR'] . ') is not authorized to update this helpdesk.';
                     return;
                 }
                 //echo "Running plugin patches...<br>";
                 if (DevblocksPlatform::runPluginPatches()) {
                     @unlink($file);
                     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('home')));
                 } else {
                     @unlink($file);
                     echo "Failure!";
                     // [TODO] Needs elaboration
                 }
                 break;
             } else {
                 echo "Another administrator is currently running update.  Please wait...";
             }
     }
     exit;
 }
开发者ID:sluther,项目名称:portsensor,代码行数:59,代码来源:classes.php

示例2: savePluginsAction

 function savePluginsAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $worker = CerberusApplication::getActiveWorker();
     if (!$worker || !$worker->is_superuser) {
         echo $translate->_('common.access_denied');
         return;
     }
     if (DEMO_MODE) {
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'plugins')));
         return;
     }
     @($plugins_enabled = DevblocksPlatform::importGPC($_REQUEST['plugins_enabled'], 'array'));
     $pluginStack = DevblocksPlatform::getPluginRegistry();
     if (is_array($plugins_enabled)) {
         foreach ($plugins_enabled as $plugin_id) {
             $plugin = $pluginStack[$plugin_id];
             $plugin->setEnabled(true);
             unset($pluginStack[$plugin_id]);
         }
     }
     // [JAS]: Clear unchecked plugins
     foreach ($pluginStack as $plugin) {
         // [JAS]: We can't force disable core here [TODO] Improve
         if ($plugin->id == 'cerberusweb.core') {
             continue;
         }
         $plugin->setEnabled(false);
     }
     DevblocksPlatform::clearCache();
     // Run any enabled plugin patches
     // [TODO] Should the platform do this automatically on enable in order?
     $patchMgr = DevblocksPlatform::getPatchService();
     $patches = DevblocksPlatform::getExtensions("devblocks.patch.container", false, true);
     if (is_array($patches)) {
         foreach ($patches as $patch_manifest) {
             /* @var $patch_manifest DevblocksExtensionManifest */
             $container = $patch_manifest->createInstance();
             /* @var $container DevblocksPatchContainerExtension */
             $patchMgr->registerPatchContainer($container);
         }
     }
     if (!$patchMgr->run()) {
         // fail
         die("Failed updating plugins.");
         // [TODO] Make this more graceful
     }
     // Reload plugin translations
     DAO_Translation::reloadPluginStrings();
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'plugins')));
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:51,代码来源:config.php

示例3: saveTabPluginsAction

 function saveTabPluginsAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $worker = FegApplication::getActiveWorker();
     if (!$worker || !$worker->is_superuser) {
         echo $translate->_('common.access_denied');
         return;
     }
     $pluginStack = DevblocksPlatform::getPluginRegistry();
     @($plugins_enabled = DevblocksPlatform::importGPC($_REQUEST['plugins_enabled']));
     if (is_array($pluginStack)) {
         foreach ($pluginStack as $plugin) {
             /* @var $plugin DevblocksPluginManifest */
             switch ($plugin->id) {
                 case 'devblocks.core':
                 case 'feg.core':
                 case 'feg.auditlog':
                     $plugin->setEnabled(true);
                     break;
                 default:
                     if (null !== $plugins_enabled && false !== array_search($plugin->id, $plugins_enabled)) {
                         $plugin->setEnabled(true);
                     } else {
                         $plugin->setEnabled(false);
                     }
                     break;
             }
         }
     }
     try {
         FegApplication::update();
     } catch (Exception $e) {
         // [TODO] ...
     }
     DevblocksPlatform::clearCache();
     // Reload plugin translations
     DAO_Translation::reloadPluginStrings();
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('setup', 'plugins')));
 }
开发者ID:rmiddle,项目名称:feg,代码行数:39,代码来源:setup.php

示例4: readPlugins

 /**
  * Reads and caches manifests from the plugin directory.
  *
  * @static 
  * @return DevblocksPluginManifest[]
  */
 static function readPlugins()
 {
     $dir = DEVBLOCKS_PLUGIN_PATH;
     $plugins = array();
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($file = readdir($dh)) !== false) {
                 if ($file == "." || $file == ".." || 0 == strcasecmp($file, "CVS")) {
                     continue;
                 }
                 $path = $dir . '/' . $file;
                 if (is_dir($path) && file_exists($path . '/plugin.xml')) {
                     $manifest = self::_readPluginManifest($file);
                     /* @var $manifest DevblocksPluginManifest */
                     if (null != $manifest) {
                         $plugins[] = $manifest;
                     }
                     /*
                      * [TODO] Somehow here we need to cache the classes from the plugin so
                      * we don't have to load up the file unless we need it.
                      * 
                      * The main place this happens is when some class from a plugin gets 
                      * persisted in the session.
                      */
                     //	                   $instance = $manifest->createInstance();
                     //	                   $instance->load($manifest);
                 }
             }
             closedir($dh);
         }
     }
     // [TODO] Instance the plugins in dependency order
     //		$plugin_instance = $manifest->createInstance();
     //		if(!$plugin_instance->install($manifest))
     //			return;
     DAO_Platform::cleanupPluginTables();
     DevblocksPlatform::clearCache();
     return $plugins;
     // [TODO] Move this to the DB
 }
开发者ID:sluther,项目名称:portsensor,代码行数:46,代码来源:Devblocks.class.php

示例5: _createTable

 private function _createTable($namespace)
 {
     $rs = mysql_query("SHOW TABLES", $this->_db);
     $tables = array();
     while ($row = mysql_fetch_row($rs)) {
         $tables[$row[0]] = true;
     }
     $namespace = $this->escapeNamespace($namespace);
     if (isset($tables['fulltext_' . $namespace])) {
         return true;
     }
     $result = mysql_query(sprintf("CREATE TABLE IF NOT EXISTS fulltext_%s (\n\t\t\t\tid INT UNSIGNED NOT NULL DEFAULT 0,\n\t\t\t\tcontent LONGTEXT,\n\t\t\t\tPRIMARY KEY (id),\n\t\t\t\tFULLTEXT content (content)\n\t\t\t) ENGINE=MyISAM CHARACTER SET=utf8;", $this->escapeNamespace($namespace)), $this->_db);
     DevblocksPlatform::clearCache(DevblocksPlatform::CACHE_TABLES);
     return false !== $result ? true : false;
 }
开发者ID:jstanden,项目名称:devblocks,代码行数:15,代码来源:Devblocks.class.php

示例6: foreach

 $plugins = DevblocksPlatform::getPluginRegistry();
 // Tailor which plugins are enabled by default
 if (is_array($plugins)) {
     foreach ($plugins as $plugin_manifest) {
         /* @var $plugin_manifest DevblocksPluginManifest */
         switch ($plugin_manifest->id) {
             case "app.core":
                 $plugin_manifest->setEnabled(true);
                 break;
             default:
                 $plugin_manifest->setEnabled(false);
                 break;
         }
     }
 }
 DevblocksPlatform::clearCache();
 // Run enabled plugin patches
 $patches = DevblocksPlatform::getExtensions("devblocks.patch.container");
 if (is_array($patches)) {
     foreach ($patches as $patch_manifest) {
         /* @var $patch_manifest DevblocksExtensionManifest */
         $container = $patch_manifest->createInstance();
         /* @var $container DevblocksPatchContainerExtension */
         $patchMgr->registerPatchContainer($container);
     }
 }
 if (!$patchMgr->run()) {
     // fail
     $tpl->assign('template', 'steps/step_init_db.tpl.php');
 } else {
     // success
开发者ID:sluther,项目名称:portsensor,代码行数:31,代码来源:index.php

示例7: cleanupPluginTables

 static function cleanupPluginTables()
 {
     DevblocksPlatform::clearCache();
     $db = DevblocksPlatform::getDatabaseService();
     $prefix = APP_DB_PREFIX != '' ? APP_DB_PREFIX . '_' : '';
     // [TODO] Cleanup
     $sql = sprintf("SELECT id FROM %splugin ", $prefix);
     $rs = $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg());
     /* @var $rs ADORecordSet */
     $plugins = DevblocksPlatform::getPluginRegistry();
     // [JAS]: Remove any plugins that are no longer in the filesystem
     while (!$rs->EOF) {
         $plugin_id = $rs->fields['id'];
         if (!isset($plugins[$plugin_id])) {
             $db->Execute(sprintf("DELETE FROM %splugin WHERE id = %s", $prefix, $db->qstr($plugin_id)));
             $db->Execute(sprintf("DELETE FROM %sextension WHERE id = %s", $prefix, $db->qstr($plugin_id)));
             $db->Execute(sprintf("DELETE FROM %sproperty_store WHERE id = %s", $prefix, $db->qstr($plugin_id)));
         }
         $rs->MoveNext();
     }
 }
开发者ID:sluther,项目名称:portsensor,代码行数:21,代码来源:DAO.php

示例8: cleanupPluginTables

 static function cleanupPluginTables()
 {
     $db = DevblocksPlatform::getDatabaseService();
     $prefix = APP_DB_PREFIX != '' ? APP_DB_PREFIX . '_' : '';
     // [TODO] Cleanup
     /*
      * Make sure this uses the DB directly and not the registry, since
      * that automatically filters out bad rows and we'd never purge them.
      */
     $sql = sprintf("SELECT p.* " . "FROM %splugin p " . "ORDER BY p.enabled DESC, p.name ASC ", $prefix);
     $results = $db->GetArray($sql);
     foreach ($results as $row) {
         $plugin = new DevblocksPluginManifest();
         @($plugin->id = $row['id']);
         @($plugin->dir = $row['dir']);
         if (!file_exists(APP_PATH . '/' . $plugin->dir)) {
             $plugin->purge();
         }
     }
     DevblocksPlatform::clearCache();
 }
开发者ID:jstanden,项目名称:devblocks,代码行数:21,代码来源:DAO.php

示例9: readPlugins

 /**
  * Reads and caches manifests from the features + plugins directories.
  *
  * @static 
  * @return DevblocksPluginManifest[]
  */
 static function readPlugins()
 {
     $scan_dirs = array('features', 'storage/plugins');
     $plugins = array();
     if (is_array($scan_dirs)) {
         foreach ($scan_dirs as $scan_dir) {
             $scan_path = APP_PATH . '/' . $scan_dir;
             if (is_dir($scan_path)) {
                 if ($dh = opendir($scan_path)) {
                     while (($file = readdir($dh)) !== false) {
                         if ($file == "." || $file == "..") {
                             continue;
                         }
                         $plugin_path = $scan_path . '/' . $file;
                         $rel_path = $scan_dir . '/' . $file;
                         if (is_dir($plugin_path) && file_exists($plugin_path . '/plugin.xml')) {
                             $manifest = self::_readPluginManifest($rel_path);
                             /* @var $manifest DevblocksPluginManifest */
                             if (null != $manifest) {
                                 $plugins[] = $manifest;
                             }
                         }
                     }
                     closedir($dh);
                 }
             }
         }
     }
     // [TODO] Instance the plugins in dependency order
     DAO_Platform::cleanupPluginTables();
     DevblocksPlatform::clearCache();
     return $plugins;
 }
开发者ID:Hildy,项目名称:devblocks,代码行数:39,代码来源:Devblocks.class.php


注:本文中的DevblocksPlatform::clearCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。