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


PHP remove_file_extension函数代码示例

本文整理汇总了PHP中remove_file_extension函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_file_extension函数的具体用法?PHP remove_file_extension怎么用?PHP remove_file_extension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: UninstallAvailable

 function UninstallAvailable($patch_list, $patch_to_check)
 {
     foreach ($patch_list as $more_recent_patch) {
         if ($more_recent_patch->id == $patch_to_check->id) {
             break;
         }
         $patch_to_check_backup_path = clean_path(remove_file_extension(from_html($patch_to_check->filename))) . '-restore';
         $more_recent_patch_backup_path = clean_path(remove_file_extension(from_html($more_recent_patch->filename))) . '-restore';
         if ($this->foundConflict($patch_to_check_backup_path, $more_recent_patch_backup_path) && $more_recent_patch->date_entered >= $patch_to_check->date_entered) {
             return false;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:14,代码来源:UpgradeHistory.php

示例2: testremove_file_extension

 public function testremove_file_extension()
 {
     //execute the method and test if it returns expected values
     //no file extension
     $expected = '';
     $actual = remove_file_extension('fileNoExt');
     $this->assertSame($expected, $actual);
     //simple file extension
     $expected = 'file1';
     $actual = remove_file_extension('file1.txt');
     $this->assertSame($expected, $actual);
     //complex filename
     $expected = 'file2.ext1';
     $actual = remove_file_extension('file2.ext1.ext2');
     $this->assertSame($expected, $actual);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:16,代码来源:fileUtilsTest.php

示例3: get_webception_config

 /**
  * Decide on which Webception configuration file to load
  * based on the 'test' query string parameter.
  *
  * If the test config is not found, it falls back to the default file.
  *
  * @param  object $app Slim's App object.
  * @return array  Array of the application config.
  */
 function get_webception_config($app)
 {
     $config = FALSE;
     $test_type = $app->request()->params('test');
     $webception_config = $app->config('webception');
     // If the test query string parameter is set,
     // a test config will be loaded.
     if ($test_type !== NULL) {
         // Sanitize the test type.
         $test_type = trim(strtolower(remove_file_extension($test_type)));
         // Filter the test type into the test string.
         $test_config = sprintf($webception_config['test'], $test_type);
         // Load the config if it can be found
         if (file_exists($test_config)) {
             $config = (require_once $test_config);
         }
     }
     if ($config == FALSE) {
         $config = (require_once $webception_config['config']);
     }
     return $config;
 }
开发者ID:jayhealey,项目名称:webception,代码行数:31,代码来源:helpers.php

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

示例5: logThis

         }
     }
 }
 logThis('finished check to see if current_db_version in $_SESSION equals target_db_version in $_SESSION');
 //Look for chance folder and delete it if found. Bug 23595
 if (function_exists('deleteChance')) {
     logThis('running deleteChance() function');
     @deleteChance();
 }
 //also add the cache cleaning here.
 if (function_exists('deleteCache')) {
     logThis('running deleteCache() function');
     @deleteCache();
 }
 //add tabs
 $from_dir = remove_file_extension($install_file) . "-restore";
 logThis('call addNewSystemTabsFromUpgrade(' . $from_dir . ')');
 addNewSystemTabsFromUpgrade($from_dir);
 logThis('finished addNewSystemTabsFromUpgrade');
 //run fix on dropdown lists that may have been incorrectly named
 //fix_dropdown_list();
 ///////////////////////////////////////////////////////////////////////////////
 ////	REGISTER UPGRADE
 logThis('Registering upgrade with UpgradeHistory');
 if (!didThisStepRunBefore('commit', 'upgradeHistory')) {
     set_upgrade_progress('commit', 'in_progress', 'upgradeHistory', 'in_progress');
     if (empty($errors)) {
         $file_action = "copied";
         // if error was encountered, script should have died before now
         $new_upgrade = new UpgradeHistory();
         $new_upgrade->filename = $install_file;
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:31,代码来源:commit.php

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

示例7: disable_copy

 function disable_copy()
 {
     //when we disable we want to copy the -restore files back into the file system
     //but we should check the version in the module install against the version on the file system
     //if they match then we can copy the file back, but otherwise we should ask the user.
     //		$GLOBALS['log']->debug('ModuleInstaller.php->disable_copy()');
     if (isset($GLOBALS['mi_overwrite_files']) && $GLOBALS['mi_overwrite_files']) {
         //		$GLOBALS['log']->debug('ModuleInstaller.php->disable_copy():mi_overwrite_files=true');
         if (!empty($this->installdefs['copy'])) {
             //				$GLOBALS['log']->debug('ModuleInstaller.php->disable_copy(): installdefs not empty');
             foreach ($this->installdefs['copy'] as $cp) {
                 $cp['to'] = clean_path(str_replace('<basepath>', $this->base_dir, $cp['to']));
                 $backup_path = clean_path(remove_file_extension(urldecode(hashToFile($_REQUEST['install_file']))) . "-restore/" . $cp['to']);
                 // bug 16966 tyoung - replaced missing assignment to $backup_path
                 //check if this file exists in the -restore directory
                 //					$GLOBALS['log']->debug("ModuleInstaller.php->disable_copy(): backup_path=".$backup_path);
                 if (file_exists($backup_path)) {
                     //since the file exists, then we want do an md5 of the install version and the file system version
                     $from = str_replace('<basepath>', $this->base_dir, $cp['from']);
                     //if(is_file($from) && md5_file($from) == md5_file($cp['to'])){
                     //since the files are the same then we can safely move back from the -restore
                     //directory into the file system
                     $GLOBALS['log']->debug("DISABLE COPY:: FROM: " . $backup_path . " TO: " . $cp['to']);
                     $this->copy_path($backup_path, $cp['to']);
                     /*}else{
                     			//since they are not equal then we need to prompt the user
                     		}*/
                 }
                 //fi
             }
             //rof
         }
         //fi
     }
     //fi
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:36,代码来源:ModuleInstaller.php

示例8: 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;
    $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);
    $upgrades_available = 0;
    $ready = "<ul>\n";
    $ready .= "\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<th></th>\n\t\t\t\t<th align=left>\n\t\t\t\t\t{$mod_strings['LBL_ML_NAME']}\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t{$mod_strings['LBL_ML_TYPE']}\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t{$mod_strings['LBL_ML_VERSION']}\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t{$mod_strings['LBL_ML_PUBLISHED']}\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t{$mod_strings['LBL_ML_UNINSTALLABLE']}\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t{$mod_strings['LBL_ML_DESCRIPTION']}\n\t\t\t\t</th>\n\t\t\t</tr>";
    $disabled = '';
    foreach ($upgrade_contents as $upgrade_content) {
        if (!preg_match("#.*\\.zip\$#i", $upgrade_content)) {
            continue;
        }
        $upgrade_content = clean_path($upgrade_content);
        $the_base = basename($upgrade_content);
        $the_md5 = md5_file($upgrade_content);
        $md5_matches = $uh->findByMd5($the_md5);
        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 = getUITextForType($manifest['type']);
            $manifest_type = $manifest['type'];
            if ($manifest_type != 'patch') {
                continue;
            }
            if (empty($manifest['icon'])) {
                $icon = getImageForType($manifest['type']);
            } else {
                $path_parts = pathinfo($manifest['icon']);
                $icon = "<img src=\"" . remove_file_extension($upgrade_content) . "-icon." . $path_parts['extension'] . "\">";
            }
            $upgrades_available++;
            if ($upgrades_available > 1) {
                logThis('ERROR: found more than 1 qualified upgrade file! Stopping upgrade.');
                $stop = true;
                // more than 1 upgrade?!?
            } else {
                logThis('found a valid upgrade file: ' . $upgrade_content);
                $_SESSION['install_file'] = $upgrade_content;
                // in-case it was there from a prior.
                $stop = false;
            }
            $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";
            $cleanUpgradeContent = urlencode($upgrade_content);
            $ready .= <<<eoq
\t            <td>
\t\t\t\t\t<form action="index.php" method="post">
\t\t\t\t\t\t<input type="hidden" name="module" value="UpgradeWizard">
\t\t\t\t\t\t<input type="hidden" name="action" value="index">
\t\t\t\t\t\t<input type="hidden" name="step" value="{$_REQUEST['step']}">
\t\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\t</form>
\t\t\t\t</td>
eoq;
            $disabled = "DISABLED";
        }
    }
    $ready .= "</table>\n";
    if ($upgrades_available == 0) {
        $ready .= "<i>None</i><br>\n";
    }
    $ready .= "</ul>\n";
    $return['ready'] = $ready;
    $return['disabled'] = $disabled;
    if ($returnFull) {
        return $return;
    }
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:84,代码来源:uw_utils.php

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

示例10: unlinkTempFiles

                     unlinkTempFiles();
                     die($mod_strings['ERR_UW_NOT_ACCEPTIBLE_TYPE']);
                 }
             } elseif ($view == "default") {
                 if ($upgrade_zip_type != "patch") {
                     unlinkTempFiles();
                     die($mod_strings['ERR_UW_ONLY_PATCHES']);
                 }
             }
             $base_filename = pathinfo($tempFile, PATHINFO_BASENAME);
             mkdir_recursive("{$base_upgrade_dir}/{$upgrade_zip_type}");
             $target_path = "{$base_upgrade_dir}/{$upgrade_zip_type}/{$base_filename}";
             $target_manifest = remove_file_extension($target_path) . "-manifest.php";
             if (isset($manifest['icon']) && $manifest['icon'] != "") {
                 $icon_location = extractFile($tempFile, $manifest['icon']);
                 copy($icon_location, remove_file_extension($target_path) . "-icon." . pathinfo($icon_location, PATHINFO_EXTENSION));
             }
             if (rename($tempFile, $target_path)) {
                 copy($manifest_file, $target_manifest);
                 $GLOBALS['ML_STATUS_MESSAGE'] = $base_filename . $mod_strings['LBL_UW_UPLOAD_SUCCESS'];
             } else {
                 $GLOBALS['ML_STATUS_MESSAGE'] = $mod_strings['ERR_UW_UPLOAD_ERROR'];
             }
         } else {
             unlinkTempFiles();
             die($mod_strings['ERR_UW_NO_MANIFEST']);
         }
     }
 } else {
     if ($run == $mod_strings['LBL_UW_BTN_DELETE_PACKAGE']) {
         if (!empty($_REQUEST['install_file'])) {
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:31,代码来源:UpgradeWizard.php

示例11: UninstallAvailable

 function UninstallAvailable($patch_list, $patch_to_check)
 {
     //before we even go through the list, let us try to see if we find a match.
     $history_object = $this->checkForExisting($patch_to_check);
     if ($history_object != null) {
         if (!empty($history_object->id_name) && !empty($patch_to_check->id_name) && strcmp($history_object->id_name, $patch_to_check->id_name) == 0 || strcmp($history_object->name, $patch_to_check->name) == 0) {
             //we have found a match
             //if the patch_to_check version is greater than the found version
             return $this->is_right_version_greater(explode('.', $history_object->version), explode('.', $patch_to_check->version));
         } else {
             return true;
         }
     }
     //we will only go through this loop if we have not found another UpgradeHistory object
     //with a matching unique_key in the database
     foreach ($patch_list as $more_recent_patch) {
         if ($more_recent_patch->id == $patch_to_check->id) {
             break;
         }
         //we will only resort to checking the files if we cannot find the unique_keys
         //or the unique_keys do not match
         $patch_to_check_backup_path = clean_path(remove_file_extension(from_html($patch_to_check->filename))) . '-restore';
         $more_recent_patch_backup_path = clean_path(remove_file_extension(from_html($more_recent_patch->filename))) . '-restore';
         if ($this->foundConflict($patch_to_check_backup_path, $more_recent_patch_backup_path) && $more_recent_patch->date_entered >= $patch_to_check->date_entered) {
             return false;
         }
     }
     return true;
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:29,代码来源:UpgradeHistory.php

示例12: foreach

\t\t</th>
\t\t<th>
\t\t\t{$mod_strings['LBL_ML_ACTION']}
\t\t</th>
\t</tr>
eoq;
foreach ($installeds as $installed) {
    $form_action = '';
    $filename = from_html($installed->filename);
    $date_entered = $installed->date_entered;
    $type = $installed->type;
    $version = $installed->version;
    $upgrades_installed++;
    $link = "";
    $view = 'default';
    $target_manifest = remove_file_extension($filename) . "-manifest.php";
    // cn: bug 9174 - cleared out upgrade dirs, or corrupt entries in upgrade_history give us bad file paths
    if (is_file($target_manifest)) {
        require_once "{$target_manifest}";
        $name = empty($manifest['name']) ? $filename : $manifest['name'];
        $description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description'];
        if (isset($manifest['icon']) && $manifest['icon'] != "") {
            $manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : "";
            $manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : "";
            $manifest_icon = clean_path($manifest['icon']);
            $icon = "<img src=\"" . $manifest_copy_files_to_dir . ($manifest_copy_files_from_dir != "" ? substr($manifest_icon, strlen($manifest_copy_files_from_dir) + 1) : $manifest_icon) . "\">";
        } else {
            $icon = getImageForType($manifest['type']);
        }
        $uwHistory .= "<form action=\"" . $form_action . "_prepare\" method=\"post\">\n" . "<tr><td>{$icon}</td><td>{$name}</td><td>{$type}</td><td>{$version}</td><td>{$date_entered}</td><td>{$description}</td><td>{$link}</td></tr>\n" . "</form>\n";
    }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:index.php

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

示例14: buildInstallGrid

 function buildInstallGrid($view)
 {
     $uh = new UpgradeHistory();
     $installeds = $uh->getAll();
     $upgrades_installed = 0;
     $installed_objects = array();
     foreach ($installeds as $installed) {
         $filename = from_html($installed->filename);
         $date_entered = $installed->date_entered;
         $type = $installed->type;
         $version = $installed->version;
         $upgrades_installed++;
         $link = "";
         switch ($type) {
             case "theme":
             case "langpack":
             case "module":
             case "patch":
                 $manifest_file = extractManifest($filename);
                 require_once $manifest_file;
                 $name = empty($manifest['name']) ? $filename : $manifest['name'];
                 $description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description'];
                 if (($upgrades_installed == 0 || $uh->UninstallAvailable($installeds, $installed)) && is_file($filename) && !empty($manifest['is_uninstallable'])) {
                     $link = urlencode($filename);
                 } else {
                     $link = 'false';
                 }
                 break;
             default:
                 break;
         }
         if ($view == 'default' && $type != 'patch') {
             continue;
         }
         if ($view == 'module' && $type != 'module' && $type != 'theme' && $type != 'langpack') {
             continue;
         }
         $target_manifest = remove_file_extension($filename) . "-manifest.php";
         require_once "{$target_manifest}";
         if (isset($manifest['icon']) && $manifest['icon'] != "") {
             $manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : "";
             $manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : "";
             $manifest_icon = clean_path($manifest['icon']);
             $icon = "<img src=\"" . $manifest_copy_files_to_dir . ($manifest_copy_files_from_dir != "" ? substr($manifest_icon, strlen($manifest_copy_files_from_dir) + 1) : $manifest_icon) . "\">";
         } else {
             $icon = getImageForType($manifest['type']);
         }
         $installed_objects[] = array('icon' => $icon, 'name' => $name, 'type' => $type, 'version' => $version, 'date_entered' => $date_entered, 'description' => $description, 'file' => $link);
         //print( "<form action=\"" . $form_action . "_prepare\" method=\"post\">\n" );
         //print( "<tr><td>$icon</td><td>$name</td><td>$type</td><td>$version</td><td>$date_entered</td><td>$description</td><td>$link</td></tr>\n" );
         //print( "</form>\n" );
     }
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:53,代码来源:PackageManagerDisplay.php

示例15: logThis

     if ($upgrade_zip_type != "patch") {
         logThis('ERROR: incorrect patch type found: ' . $upgrade_zip_type);
         unlinkTempFiles();
         $out = "<b><span class='error'>{$mod_strings['ERR_UW_ONLY_PATCHES']}</span></b><br />";
         break;
     }
     $base_filename = preg_replace("#\\\\#", "/", $base_filename);
     $base_filename = basename($base_filename);
     mkdir_recursive("{$base_upgrade_dir}/{$upgrade_zip_type}");
     $target_path = "{$base_upgrade_dir}/{$upgrade_zip_type}/{$base_filename}";
     $target_manifest = remove_file_extension($target_path) . "-manifest.php";
     if (isset($manifest['icon']) && $manifest['icon'] != "") {
         logThis('extracting icons.');
         $icon_location = extractFile($tempFile, $manifest['icon']);
         $path_parts = pathinfo($icon_location);
         copy($icon_location, remove_file_extension($target_path) . "-icon." . $path_parts['extension']);
     }
     if (copy($tempFile, $target_path)) {
         logThis('copying manifest.php to final destination.');
         copy($manifest_file, $target_manifest);
         $out .= "<b>{$base_filename} {$mod_strings['LBL_UW_FILE_UPLOADED']}.</b><br>\n";
     } else {
         logThis('ERROR: cannot copy manifest.php to final destination.');
         $out .= "<b><span class='error'>{$mod_strings['ERR_UW_UPLOAD_ERR']}</span></b><br />";
         break;
     }
 } else {
     logThis('ERROR: no manifest.php file found!');
     unlinkTempFiles();
     $out = "<b><span class='error'>{$mod_strings['ERR_UW_NO_MANIFEST']}</span></b><br />";
     break;
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:31,代码来源:upload.php


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