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


PHP UpgradeHistory::checkDependencies方法代码示例

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


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

示例1: UpgradeHistory

if (isset($manifest['dependencies'])) {
    $dependencies = $manifest['dependencies'];
}
if (isset($manifest['remove_tables'])) {
    $remove_tables = $manifest['remove_tables'];
}
if ($remove_tables != 'prompt') {
    $hidden_fields .= "<input type=hidden name=\"remove_tables\" value='" . $remove_tables . "'>";
}
if (file_exists($readme_file) || !empty($manifest['readme'])) {
    $found_readme = true;
}
$uh = new UpgradeHistory();
//check dependencies first
if (!empty($dependencies)) {
    $not_found = $uh->checkDependencies($dependencies);
    if (!empty($not_found) && count($not_found) > 0) {
        die($mod_strings['ERR_UW_NO_DEPENDENCY'] . "[" . implode(',', $not_found) . "]");
    }
    //fi
}
switch ($install_type) {
    case "full":
    case "patch":
        if (!is_writable("config.php")) {
            die($mod_strings['ERR_UW_CONFIG']);
        }
        break;
    case "theme":
        break;
    case "langpack":
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:UpgradeWizard_prepare.php

示例2: getPackagesInStaging

 function getPackagesInStaging($view = 'module')
 {
     global $sugar_config;
     global $current_language;
     $uh = new UpgradeHistory();
     $base_upgrade_dir = "upload://upgrades";
     $base_tmp_upgrade_dir = sugar_cached("upgrades/temp");
     $uContent = findAllFiles($base_upgrade_dir, array(), false, 'zip');
     $upgrade_contents = array();
     $content_values = array_values($uContent);
     $alreadyProcessed = array();
     foreach ($content_values as $val) {
         if (empty($alreadyProcessed[$val])) {
             $upgrade_contents[] = $val;
             $alreadyProcessed[$val] = true;
         }
     }
     $upgrades_available = 0;
     $packages = array();
     $mod_strings = return_module_language($current_language, "Administration");
     foreach ($upgrade_contents as $upgrade_content) {
         if (!preg_match('#.*\\.zip$#', strtolower($upgrade_content)) || preg_match("#.*./zips/.*#", strtolower($upgrade_content))) {
             continue;
         }
         $the_base = basename($upgrade_content);
         $the_md5 = md5_file($upgrade_content);
         $md5_matches = $uh->findByMd5($the_md5);
         $file_install = $upgrade_content;
         if (empty($md5_matches)) {
             $target_manifest = remove_file_extension($upgrade_content) . '-manifest.php';
             require_once $target_manifest;
             $name = empty($manifest['name']) ? $upgrade_content : $manifest['name'];
             $version = empty($manifest['version']) ? '' : $manifest['version'];
             $published_date = empty($manifest['published_date']) ? '' : $manifest['published_date'];
             $icon = '';
             $description = empty($manifest['description']) ? 'None' : $manifest['description'];
             $uninstallable = empty($manifest['is_uninstallable']) ? 'No' : 'Yes';
             $type = $this->getUITextForType($manifest['type']);
             $manifest_type = $manifest['type'];
             $dependencies = array();
             if (isset($manifest['dependencies'])) {
                 $dependencies = $manifest['dependencies'];
             }
             //check dependencies first
             if (!empty($dependencies)) {
                 $uh = new UpgradeHistory();
                 $not_found = $uh->checkDependencies($dependencies);
                 if (!empty($not_found) && count($not_found) > 0) {
                     $file_install = 'errors_' . $mod_strings['ERR_UW_NO_DEPENDENCY'] . "[" . implode(',', $not_found) . "]";
                 }
             }
             if ($view == 'default' && $manifest_type != 'patch') {
                 continue;
             }
             if ($view == 'module' && $manifest_type != 'module' && $manifest_type != 'theme' && $manifest_type != 'langpack') {
                 continue;
             }
             if (empty($manifest['icon'])) {
                 $icon = $this->getImageForType($manifest['type']);
             } else {
                 $path_parts = pathinfo($manifest['icon']);
                 $icon = "<img src=\"" . remove_file_extension($upgrade_content) . "-icon." . $path_parts['extension'] . "\">";
             }
             $upgrades_available++;
             $packages[] = array('name' => $name, 'version' => $version, 'published_date' => $published_date, 'description' => $description, 'uninstallable' => $uninstallable, 'type' => $type, 'file' => fileToHash($upgrade_content), 'file_install' => fileToHash($upgrade_content));
         }
         //fi
     }
     //rof
     return $packages;
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:71,代码来源:PackageManager.php

示例3: getPackagesInStaging

 function getPackagesInStaging($view = 'module')
 {
     global $sugar_config;
     global $current_language;
     $uh = new UpgradeHistory();
     $base_upgrade_dir = $sugar_config['upload_dir'] . "/upgrades";
     $base_tmp_upgrade_dir = "{$base_upgrade_dir}/temp";
     $uContent = findAllFiles("{$base_upgrade_dir}", array(), false, 'zip', $base_tmp_upgrade_dir);
     //other variations of zip file i.e. ZIP, zIp,zIP,Zip,ZIp,ZiP
     $extns = array('ZIP', 'ZIp', 'ZiP', 'Zip', 'zIP', 'zIp', 'ziP');
     foreach ($extns as $extn) {
         $uContent = array_merge($uContent, findAllFiles("{$base_upgrade_dir}", array(), false, $extn, $base_tmp_upgrade_dir));
     }
     $upgrade_contents = array();
     $content_values = array_values($uContent);
     $alreadyProcessed = array();
     foreach ($content_values as $val) {
         if (empty($alreadyProcessed[$val])) {
             $upgrade_contents[] = $val;
             $alreadyProcessed["{$val}"] = true;
         }
     }
     $upgrades_available = 0;
     $packages = array();
     $mod_strings = return_module_language($current_language, "Administration");
     foreach ($upgrade_contents as $upgrade_content) {
         if (!preg_match("#.*\\.zip\$#", strtolower($upgrade_content)) || preg_match("#.*./zips/.*#", strtolower($upgrade_content))) {
             continue;
         }
         $upgrade_content = clean_path($upgrade_content);
         // Bug 22285 - fix for UNC paths
         if (substr($upgrade_content, 0, 2) == '\\\\') {
             $upgrade_content = '\\\\' . $upgrade_content;
         }
         $the_base = basename($upgrade_content);
         $the_md5 = md5_file($upgrade_content);
         $md5_matches = $uh->findByMd5($the_md5);
         $file_install = $upgrade_content;
         if (0 == sizeof($md5_matches)) {
             $target_manifest = remove_file_extension($upgrade_content) . '-manifest.php';
             require_once $target_manifest;
             $name = empty($manifest['name']) ? $upgrade_content : $manifest['name'];
             $version = empty($manifest['version']) ? '' : $manifest['version'];
             $published_date = empty($manifest['published_date']) ? '' : $manifest['published_date'];
             $icon = '';
             $description = empty($manifest['description']) ? 'None' : $manifest['description'];
             $uninstallable = empty($manifest['is_uninstallable']) ? 'No' : 'Yes';
             $type = $this->getUITextForType($manifest['type']);
             $manifest_type = $manifest['type'];
             $dependencies = array();
             if (isset($manifest['dependencies'])) {
                 $dependencies = $manifest['dependencies'];
             }
             //check dependencies first
             if (!empty($dependencies)) {
                 $uh = new UpgradeHistory();
                 $not_found = $uh->checkDependencies($dependencies);
                 if (!empty($not_found) && count($not_found) > 0) {
                     $file_install = 'errors_' . $mod_strings['ERR_UW_NO_DEPENDENCY'] . "[" . implode(',', $not_found) . "]";
                 }
                 //fi
             }
             if ($view == 'default' && $manifest_type != 'patch') {
                 continue;
             }
             if ($view == 'module' && $manifest_type != 'module' && $manifest_type != 'theme' && $manifest_type != 'langpack') {
                 continue;
             }
             if (empty($manifest['icon'])) {
                 $icon = $this->getImageForType($manifest['type']);
             } else {
                 $path_parts = pathinfo($manifest['icon']);
                 $icon = "<img src=\"" . remove_file_extension($upgrade_content) . "-icon." . $path_parts['extension'] . "\">";
             }
             $upgrades_available++;
             // uploaded file in cache/upload
             $fileS = explode('/', $upgrade_content);
             $c = count($fileS);
             $fileName = isset($fileS[$c - 1]) && !empty($fileS[$c - 1]) ? $fileS[$c - 1] : $fileS[$c - 2];
             $upload_file = $sugar_config['upload_dir'] . $fileName;
             $upgrade_content = urlencode($upgrade_content);
             $upload_content = urlencode($upload_file);
             $packages[] = array('name' => $name, 'version' => $version, 'published_date' => $published_date, 'description' => $description, 'uninstallable' => $uninstallable, 'type' => $type, 'file_install' => fileToHash($file_install), 'file' => fileToHash($upgrade_content), 'upload_file' => $upload_content);
         }
         //fi
     }
     //rof
     return $packages;
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:89,代码来源:PackageManager.php


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