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


PHP UpgradeHistory::findByMd5方法代码示例

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


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

示例1: UW_get_patch_for_file

/**
 * Returns manifest patch from upgrade history of the given install file
 *
 * @param string $install_file
 * @return array
 */
function UW_get_patch_for_file($install_file)
{
    $history = new UpgradeHistory();
    $md5 = md5_file($install_file);
    $matches = $history->findByMd5($md5);
    $history = array_shift($matches);
    if ($history && $history->patch) {
        return unserialize(base64_decode($history->patch));
    }
    return array();
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:17,代码来源:UpgradeWizard_commit.php

示例2: getLangPacks

/**
 * searches upgrade dir for lang pack files.
 *
 * @return string HTML of available lang packs
 */
function getLangPacks($display_commit = true, $types = array('langpack'), $notice_text = '')
{
    global $mod_strings;
    global $next_step;
    global $base_upgrade_dir;
    if (empty($notice_text)) {
        $notice_text = $mod_strings['LBL_LANG_PACK_READY'];
    }
    $ret = "<tr><td colspan=7 align=left>{$notice_text}</td></tr>";
    //$ret .="<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
    $ret .= "<tr>\n                <td width='20%' ><b>{$mod_strings['LBL_ML_NAME']}</b></td>\n                <td width='15%' ><b>{$mod_strings['LBL_ML_VERSION']}</b></td>\n                <td width='15%' ><b>{$mod_strings['LBL_ML_PUBLISHED']}</b></td>\n                <td width='15%' ><b>{$mod_strings['LBL_ML_UNINSTALLABLE']}</b></td>\n                <td width='20%' ><b>{$mod_strings['LBL_ML_DESCRIPTION']}</b></td>\n                <td width='7%' ></td>\n                <td width='1%' ></td>\n                <td width='7%' ></td>\n            </tr>\n";
    $files = array();
    // duh, new installs won't have the upgrade folders
    if (!is_dir($base_upgrade_dir)) {
        mkdir_recursive($base_upgrade_dir);
    }
    $subdirs = array('full', 'langpack', 'module', 'patch', 'theme', 'temp');
    foreach ($subdirs as $subdir) {
        mkdir_recursive("{$base_upgrade_dir}/{$subdir}");
    }
    $files = findAllFiles($base_upgrade_dir, $files);
    $hidden_input = '';
    unset($_SESSION['hidden_input']);
    foreach ($files as $file) {
        if (!preg_match("#.*\\.zip\$#", $file)) {
            continue;
        }
        // skip installed lang packs
        if (isset($_SESSION['INSTALLED_LANG_PACKS']) && in_array($file, $_SESSION['INSTALLED_LANG_PACKS'])) {
            continue;
        }
        // handle manifest.php
        $target_manifest = remove_file_extension($file) . '-manifest.php';
        $license_file = remove_file_extension($file) . '-license.txt';
        include $target_manifest;
        if (!empty($types)) {
            if (!in_array(strtolower($manifest['type']), $types)) {
                continue;
            }
        }
        $md5_matches = array();
        if ($manifest['type'] == 'module') {
            $uh = new UpgradeHistory();
            $upgrade_content = clean_path($file);
            $the_base = basename($upgrade_content);
            $the_md5 = md5_file($upgrade_content);
            $md5_matches = $uh->findByMd5($the_md5);
        }
        if ($manifest['type'] != 'module' || 0 == sizeof($md5_matches)) {
            $name = empty($manifest['name']) ? $file : $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';
            $manifest_type = $manifest['type'];
            $commitPackage = getPackButton('commit', $target_manifest, $file, $next_step);
            $deletePackage = getPackButton('remove', $target_manifest, $file, $next_step);
            //$ret .="<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
            $ret .= "<tr>";
            $ret .= "<td width='20%' >" . $name . "</td>";
            $ret .= "<td width='15%' >" . $version . "</td>";
            $ret .= "<td width='15%' >" . $published_date . "</td>";
            $ret .= "<td width='15%' >" . $uninstallable . "</td>";
            $ret .= "<td width='20%' >" . $description . "</td>";
            if ($display_commit) {
                $ret .= "<td width='7%'>{$commitPackage}</td>";
            }
            $ret .= "<td width='1%'></td>";
            $ret .= "<td width='7%'>{$deletePackage}</td>";
            $ret .= "</td></tr>";
            $clean_field_name = "accept_lic_" . str_replace('.', '_', urlencode(basename($file)));
            if (is_file($license_file)) {
                //rrs
                $ret .= "<tr><td colspan=6>";
                $ret .= getLicenseDisplay('commit', $target_manifest, $file, $next_step, $license_file, $clean_field_name);
                $ret .= "</td></tr>";
                $hidden_input .= "<input type='hidden' name='{$clean_field_name}' id='{$clean_field_name}' value='no'>";
            } else {
                $hidden_input .= "<input type='hidden' name='{$clean_field_name}' id='{$clean_field_name}' value='yes'>";
            }
        }
        //fi
    }
    //rof
    $_SESSION['hidden_input'] = $hidden_input;
    if (count($files) > 0) {
        $ret .= "</tr><td colspan=7>";
        $ret .= "<form name='commit' action='install.php' method='POST'>\n                    <input type='hidden' name='current_step' value='{$next_step}'>\n                    <input type='hidden' name='goto' value='Re-check'>\n                    <input type='hidden' name='languagePackAction' value='commit'>\n                    <input type='hidden' name='install_type' value='custom'>\n                 </form>\n                ";
        $ret .= "</td></tr>";
    } else {
        $ret .= "</tr><td colspan=7><i>{$mod_strings['LBL_LANG_NO_PACKS']}</i></td></tr>";
    }
    return $ret;
}
开发者ID:stefano6310,项目名称:SuiteCRM,代码行数:100,代码来源:install_utils.php

示例3: 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

示例4: getValidPatchName

/**
 * gets valid patch file names that exist in upload/upgrade/patch/
 */
function getValidPatchName($returnFull = true)
{
    global $base_upgrade_dir;
    global $mod_strings;
    global $uh;
    global $sugar_version;
    global $sugar_config;
    $uh = new UpgradeHistory();
    list($base_upgrade_dir, $base_tmp_upgrade_dir) = getUWDirs();
    $return = array();
    // scan for new files (that are not installed)
    logThis('finding new files for upgrade');
    $upgrade_content = '';
    $upgrade_contents = findAllFiles($base_upgrade_dir, array(), false, 'zip');
    //other variations of zip file i.e. ZIP, zIp,zIP,Zip,ZIp,ZiP
    $ready = "<ul>\n";
    $ready .= "\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_NAME']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_TYPE']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_VERSION']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_PUBLISHED']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_UNINSTALLABLE']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_DESCRIPTION']}</b>\n\t\t\t\t</td>\n\t\t\t</tr>";
    $disabled = '';
    // assume old patches are there.
    $upgradeToVersion = array();
    // fill with valid patches - we will only use the latest qualified found patch
    // cn: bug 10609 - notices for uninitialized variables
    $icon = '';
    $name = '';
    $type = '';
    $version = '';
    $published_date = '';
    $uninstallable = '';
    $description = '';
    $disabled = '';
    foreach ($upgrade_contents as $upgrade_content) {
        if (!preg_match("#.*\\.zip\$#i", $upgrade_content)) {
            continue;
        }
        $the_base = basename($upgrade_content);
        $the_md5 = md5_file($upgrade_content);
        $md5_matches = $uh->findByMd5($the_md5);
        /* If a patch is in the /patch dir AND has no record in the upgrade_history table we assume that it's the one we want.
         * Edge-case: manual upgrade with a FTP of a patch; UH table has no entry for it.  Assume nothing. :( */
        if (0 == sizeof($md5_matches)) {
            $target_manifest = remove_file_extension($upgrade_content) . '-manifest.php';
            require_once $target_manifest;
            if (empty($manifest['version'])) {
                logThis("*** Potential error: patch found with no version [ {$upgrade_content} ]");
                continue;
            }
            if (!isset($manifest['type']) || $manifest['type'] != 'patch') {
                logThis("*** Potential error: patch found with either no 'type' or non-patch type [ {$upgrade_content} ]");
                continue;
            }
            $upgradeToVersion[$manifest['version']] = urlencode($upgrade_content);
            $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 = getUITextForType($manifest['type']);
            $manifest_type = $manifest['type'];
            if (empty($manifest['icon'])) {
                $icon = getImageForType($manifest['type']);
            } else {
                $path_parts = pathinfo($manifest['icon']);
                $icon = "<!--not_in_theme!--><img src=\"" . remove_file_extension($upgrade_content) . "-icon." . $path_parts['extension'] . "\">";
            }
        }
    }
    // cn: bug 10488 use the NEWEST upgrade/patch available when running upgrade wizard.
    ksort($upgradeToVersion);
    $upgradeToVersion = array_values($upgradeToVersion);
    $newest = array_pop($upgradeToVersion);
    $_SESSION['install_file'] = urldecode($newest);
    // in-case it was there from a prior.
    logThis("*** UW using [ {$_SESSION['install_file']} ] as source for patch files.");
    $cleanUpgradeContent = urlencode($_SESSION['install_file']);
    // cn: 10606 - cannot upload a patch file since this returned always.
    if (!empty($cleanUpgradeContent)) {
        $ready .= "<tr><td>{$icon}</td><td>{$name}</td><td>{$type}</td><td>{$version}</td><td>{$published_date}</td><td>{$uninstallable}</td><td>{$description}</td>\n";
        $ready .= <<<eoq
\t        <td>
\t\t\t\t<form action="index.php" method="post">
\t\t\t\t\t<input type="hidden" name="module" value="UpgradeWizard">
\t\t\t\t\t<input type="hidden" name="action" value="index">
\t\t\t\t\t<input type="hidden" name="step" value="{$_REQUEST['step']}">
\t\t\t\t\t<input type="hidden" name="run" value="delete">
\t        \t\t<input type=hidden name="install_file" value="{$cleanUpgradeContent}" />
\t        \t\t<input type=submit value="{$mod_strings['LBL_BUTTON_DELETE']}" />
\t\t\t\t</form>
\t\t\t</td></table>
eoq;
        $disabled = "DISABLED";
    }
    if (empty($cleanUpgradeContent)) {
        $ready .= "<tr><td colspan='7'><i>None</i></td>\n";
        $ready .= "</table>\n";
    }
    $ready .= "<br></ul>\n";
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:sugar_work,代码行数:101,代码来源:uw_utils.php

示例5: UpgradeHistory

        $uh = new UpgradeHistory();
        $the_md5 = md5_file($install_file);
        $md5_matches = $uh->findByMd5($the_md5);
        if (sizeof($md5_matches) == 0) {
            die("{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} {$install_file}.");
        }
        foreach ($md5_matches as $md5_match) {
            $md5_match->enabled = 0;
            $md5_match->save();
        }
        break;
    case "Enable":
        $file_action = "enabled";
        $uh = new UpgradeHistory();
        $the_md5 = md5_file($install_file);
        $md5_matches = $uh->findByMd5($the_md5);
        if (sizeof($md5_matches) == 0) {
            die("{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} {$install_file}.");
        }
        foreach ($md5_matches as $md5_match) {
            $md5_match->enabled = 1;
            $md5_match->save();
        }
        break;
}
// present list to user
?>
<form action="<?php 
print $form_action;
?>
" method="post">
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:UpgradeWizard_commit.php

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