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


PHP module_config::download_update方法代码示例

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


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

示例1: array

                    }
                } else {
                    $upgrade_plugins = $_REQUEST['doupdate'];
                }
                $completed_updates = array();
                foreach ($upgrade_plugins as $plugin_name => $tf) {
                    $this_update = false;
                    foreach ($available_updates['plugins'] as $available_update) {
                        if ($available_update['key'] == $plugin_name) {
                            $this_update = $available_update;
                            break;
                        }
                    }
                    if ($this_update) {
                        echo "Downloading files: <span style='text-decoration:underline;'>" . htmlspecialchars($this_update['description']) . "</span>... ";
                        if ($update = module_config::download_update($this_update['key'])) {
                            ?>
                <span class="success_text">complete!</span>
                <a href="#" onclick="$('#update_<?php 
                            echo $this_update['key'];
                            ?>
').toggle();">[view details]</a>
                <div style="font-weight: 0.9em; padding:9px; display: none;" id="update_<?php 
                            echo $this_update['key'];
                            ?>
">
                <?php 
                            //echo '<pre>';print_r($update);exit;
                            foreach ($update['plugins'] as $available_update) {
                                if ($available_update['key'] != $this_update['key']) {
                                    // core update bug fix.
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:config_upgrade.php

示例2: install_plugin_update_files

 public function install_plugin_update_files($plugin_name)
 {
     $result = array('message' => '', 'plugin_name' => $plugin_name);
     $errors = array();
     if (!strlen(trim(module_config::c('_installation_code')))) {
         $result['message'] = 'Please enter your license code before doing an upgrade.';
     } else {
         /*$available_updates = module_config::check_for_upgrades($plugin_name);
           if($available_updates && isset($available_updates['message']) && strlen(trim($available_updates['message']))>2){
               $result['message'] = $available_updates['message'];
           }else{*/
         $completed_updates = array();
         // we useto process multiple plugin updates at a time, not any more..
         $upgrade_plugins = array($plugin_name);
         // hack so we can 'continue/break' out of loop below.
         foreach ($upgrade_plugins as $plugin_name) {
             $this_update = array('key' => $plugin_name);
             /*$this_update = false;
               foreach($available_updates['plugins'] as $available_update){
                   if($available_update['key'] == $plugin_name){
                       $this_update = $available_update;
                       break;
                   }
               }*/
             if ($this_update && strlen(trim($this_update['key']))) {
                 $result['message'] .= "Downloading files... <br/>\n";
                 if ($update = module_config::download_update($this_update['key'])) {
                     foreach ($update['plugins'] as $available_update) {
                         if ($available_update['key'] != $this_update['key']) {
                             // core update bug fix.
                             continue;
                         }
                         // have we done this yet?
                         if (isset($completed_updates[$available_update['key']])) {
                             continue;
                         }
                         $completed_updates[$available_update['key']] = true;
                         foreach ($available_update['folders'] as $file) {
                             if (!is_dir(_UCM_FOLDER . $file)) {
                                 $result['message'] .= "Folder: {$file} <br/>\n";
                                 $result['message'] .= '<span class="small">';
                                 if (is_dir(_UCM_FOLDER . $file)) {
                                     $result['message'] .= 'this folder exists, nothing will change.';
                                 } else {
                                     // check if writable
                                     if (mkdir(_UCM_FOLDER . $file, 0777, true)) {
                                         $result['message'] .= 'this new folder has been <strong>created</strong>';
                                     } else {
                                         $error = '<strong>WARNING:</strong> failed to create new folder: ' . $file;
                                         $errors[] = $error;
                                         $result['message'] .= $error;
                                     }
                                 }
                                 $result['message'] .= "</span><br/>";
                             }
                         }
                         foreach ($available_update['files'] as $file) {
                             $result['message'] .= "File: {$file} <br/>\n";
                             $result['message'] .= '<span class="small">';
                             if (in_array($file, $this->held_files)) {
                                 $error = '<strong>Custom:</strong> file not upgraded: ' . $file;
                                 $errors[] = $error;
                                 $result['message'] .= $error;
                             } else {
                                 if (!isset($available_update['file_contents'][$file])) {
                                     $error = '<strong>WARNING:</strong> failed to get file contents from server: ' . $file;
                                     $errors[] = $error;
                                     $result['message'] .= $error;
                                 } else {
                                     if (!file_put_contents(_UCM_FOLDER . $file, base64_decode($available_update['file_contents'][$file]))) {
                                         $error = '<strong>WARNING:</strong> failed to install the file: ' . $file;
                                         $errors[] = $error;
                                         $result['message'] .= $error;
                                     } else {
                                         $result['message'] .= 'this file has been <strong>installed</strong> successfully';
                                     }
                                 }
                             }
                             $result['message'] .= "</span><br/>";
                         }
                     }
                     //exit;
                 } else {
                     $error = "failed to download files ({$plugin_name}):";
                     $errors[] = $error;
                     $result['message'] .= '<span class="error_text">' . $error . '</span><br/> ';
                 }
                 //$_REQUEST['run_upgrade'] = true; // so we do the DB update again down the bottom.
             } else {
                 $error = "Failed to start update ({$plugin_name}):";
                 $errors[] = $error;
                 $result['message'] .= $error . '<br/>';
             }
         }
         /*}*/
     }
     $result['errors'] = $errors;
     if (!count($errors)) {
         $result['success'] = 1;
     }
//.........这里部分代码省略.........
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:class.upgrade.php


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