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


PHP Kohana::cache_save方法代码示例

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


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

示例1: status

 public function status($step = 0)
 {
     $this->template = "";
     $this->auto_render = FALSE;
     $url = $this->release->download;
     $working_dir = Kohana::config('upload.relative_directory') . "/upgrade/";
     $zip_file = Kohana::config('upload.relative_directory') . "/upgrade/ushahidi.zip";
     if ($step == 0) {
         $this->upgrade->logger("Downloading latest version of ushahidi...");
         echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.download')));
     }
     if ($step == 1) {
         // Create the Directory if it doesn't exist
         if (!file_exists(DOCROOT . "media/uploads/upgrade")) {
             mkdir(DOCROOT . "media/uploads/upgrade");
             chmod(DOCROOT . "media/uploads/upgrade", 0777);
             $this->upgrade->logger("Creating Directory - " . DOCROOT . "media/uploads/upgrade");
         }
         $latest_ushahidi = $this->upgrade->download_ushahidi($url);
         //download was successful
         if ($this->upgrade->success) {
             $this->upgrade->write_to_file($latest_ushahidi, $zip_file);
             $this->upgrade->logger("Successfully Downloaded. Unpacking " . $zip_file);
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.successfully_downloaded')));
         } else {
             $this->upgrade->logger("** Failed downloading.\n\n");
             echo json_encode(array("status" => "error", "message" => Kohana::lang('upgrade.failed_downloading')));
         }
     }
     if ($step == 2) {
         //extract compressed file
         $this->upgrade->unzip_ushahidi($zip_file, $working_dir);
         //extraction was successful
         if ($this->upgrade->success) {
             $this->upgrade->logger("Successfully Unpacked. Copying files...");
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.successfully_unpacked')));
         } else {
             $this->upgrade->logger("** Failed unpacking.\n\n");
             echo json_encode(array("status" => "error", "message" => Kohana::lang('upgrade.failed_unpacking')));
         }
     }
     if ($step == 3) {
         //copy files
         $this->upgrade->ftp_recursively($working_dir . "ushahidi/", DOCROOT);
         $this->upgrade->remove_old($working_dir . 'ushahidi/upgrader_removed_files.txt', DOCROOT);
         // Clear out caches before new request
         Cache::instance()->delete_all();
         Kohana::cache_save('configuration', NULL, Kohana::config('core.internal_cache'));
         Kohana::cache_save('language', NULL, Kohana::config('core.internal_cache'));
         Kohana::cache_save('find_file_paths', NULL, Kohana::config('core.internal_cache'));
         Event::clear('system.shutdown', array('Kohana', 'internal_cache_save'));
         //copying was successful
         if ($this->upgrade->success) {
             $this->upgrade->logger("Successfully Copied. Upgrading Database...");
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.successfully_copied')));
         } else {
             $this->upgrade->logger("** Failed copying files.\n\n");
             echo json_encode(array("status" => "error", "message" => Kohana::lang('upgrade.failed_copying')));
         }
     }
     // Database BACKUP + UPGRADE
     if ($step == 4) {
         // backup database.
         // is gzip enabled ?
         $gzip = Kohana::config('config.output_compression');
         $error = $this->_do_db_backup($gzip);
         if (empty($error)) {
             if (file_exists(DOCROOT . "sql/")) {
                 $this->_process_db_upgrade(DOCROOT . "sql/");
             }
             $this->upgrade->logger("Database backup and upgrade successful.");
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.backup_success')));
         } else {
             $this->upgrade->logger("** Failed backing up database.\n\n");
             echo json_encode(array("status" => "error", "message" => Kohana::lang('upgrade.backup_failed')));
         }
     }
     // Database UPGRADE ONLY
     if ($step == 5) {
         if (file_exists(DOCROOT . "sql/")) {
             //upgrade tables
             $this->_process_db_upgrade(DOCROOT . "sql/");
             $this->upgrade->logger("Database upgrade successful.");
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.dbupgrade_success')));
         } else {
             $this->upgrade->logger("Database upgrade successful.");
             echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.dbupgrade_success')));
         }
     }
     // Delete downloaded files
     if ($step == 6) {
         $this->upgrade->logger("Deleting downloaded files...");
         echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.deleting_files')));
     }
     if ($step == 7) {
         $this->upgrade->remove_recursively($working_dir);
         $this->upgrade->logger("UPGRADE SUCCESSFUL");
         echo json_encode(array("status" => "success", "message" => Kohana::lang('upgrade.upgrade_success', array(url::site("admin/upgrade/logfile?f=" . $this->session->get('upgrade_session') . ".txt")))));
         $this->session->delete('upgrade_session');
     }
//.........这里部分代码省略.........
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:101,代码来源:upgrade.php

示例2: save_cache

 /**
  * Saves a cached version of this configuration driver
  *
  * @return  bool
  * @access  public
  */
 public function save_cache()
 {
     // If this configuration has changed
     if ($this->get('core.internal_cache') !== FALSE and $this->changed) {
         $data = $this->config;
         // Save the cache
         return Kohana::cache_save($this->cache_name, $data, $this->cache_lifetime);
     }
     return TRUE;
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:16,代码来源:Config.php

示例3: internal_cache_save

 /**
  * Saves the internal caches: configuration, include paths, etc.
  *
  * @return  boolean
  */
 public static function internal_cache_save()
 {
     if (!is_array(Kohana::$write_cache)) {
         return FALSE;
     }
     // Get internal cache names
     $caches = array_keys(Kohana::$write_cache);
     // Nothing written
     $written = FALSE;
     foreach ($caches as $cache) {
         if (isset(Kohana::$internal_cache[$cache])) {
             // Write the cache file
             Kohana::cache_save($cache, Kohana::$internal_cache[$cache], Kohana::config('core.internal_cache'));
             // A cache has been written
             $written = TRUE;
         }
     }
     return $written;
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:24,代码来源:Kohana.php


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