當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Theme_Upgrader::maintenance_mode方法代碼示例

本文整理匯總了PHP中Theme_Upgrader::maintenance_mode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Theme_Upgrader::maintenance_mode方法的具體用法?PHP Theme_Upgrader::maintenance_mode怎麽用?PHP Theme_Upgrader::maintenance_mode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Theme_Upgrader的用法示例。


在下文中一共展示了Theme_Upgrader::maintenance_mode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: do_theme_update

 /**
  * Process automatic theme update
  *
  * @since 1.0.0
  */
 public function do_theme_update()
 {
     if (!isset($_REQUEST['nonce'])) {
         die;
     }
     if (!wp_verify_nonce(esc_attr($_REQUEST['nonce']), 'monstroid-dashboard')) {
         die;
     }
     if (!current_user_can('update_themes')) {
         die;
     }
     monstroid_dashboard()->filesystem->add_creds();
     $backup_link = $this->try_make_backup();
     include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
     include_once monstroid_dashboard()->plugin_dir('admin/includes/class-monstroid-dashboard-upgrader-skin.php');
     $title = __('Update Monstroid theme', 'monstroid-dashboard');
     $theme = 'monstroid';
     $upgrader = new Theme_Upgrader(new Monstroid_Dashboard_Upgrader_Skin(compact('title', 'theme')));
     ini_set('max_execution_time', -1);
     set_time_limit(0);
     $update = $upgrader->upgrade($theme);
     $log = $upgrader->skin->get_install_log();
     $success = __('Great news! Monstroid Dashboard successfully updated your theme to the latest available version', 'monstroid-dashboard');
     if (true == $update) {
         $this->clear_update_data();
         wp_send_json_success(array('message' => $success, 'newVersion' => $this->get_update_data('new_version'), 'updateLog' => $log));
     }
     $upgrader->maintenance_mode(false);
     if (is_wp_error($update)) {
         wp_send_json_error(array('message' => sprintf(__('Update failed. %s', 'monstroid-dashboard'), $update->get_error_message()), 'updateLog' => $log));
     }
     if (!$update) {
         wp_send_json_error(array('message' => __('Update failed. <a href="#" class="show-update-log">Show update log</a>', 'monstroid-dashboard'), 'updateLog' => $log));
     }
     wp_send_json_error(array('message' => __('Unknown error, please try again later or contact our support', 'monstroid-dashboard'), 'updateLog' => $log));
 }
開發者ID:CherryFramework,項目名稱:monstroid-dashboard,代碼行數:41,代碼來源:class-monstroid-dashboard-updater.php


注:本文中的Theme_Upgrader::maintenance_mode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。