• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP unlinkTempFiles函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: clean_path

            $version = $manifest['version'];
        }
        if (!is_writable("config.php")) {
            return $mod_strings['ERR_UW_CONFIG'];
        }
        $_SESSION['unzip_dir'] = clean_path($unzip_dir);
        $_SESSION['zip_from_dir'] = clean_path($zip_from_dir);
        logThis('unzip done.');
    } else {
        $unzip_dir = $_SESSION['unzip_dir'];
        $zip_from_dir = $_SESSION['zip_from_dir'];
    }
    //check if $_SESSION['unzip_dir'] and $_SESSION['zip_from_dir'] exist
    if (!isset($_SESSION['unzip_dir']) || !file_exists($_SESSION['unzip_dir']) || !isset($_SESSION['install_file']) || empty($_SESSION['install_file']) || !file_exists($_SESSION['install_file'])) {
        //redirect to start
        unlinkTempFiles();
        resetUwSession();
        echo 'Upload File not found so redirecting to Upgrade Start ';
        $redirect_new_wizard = $sugar_config['site_url'] . '/index.php?module=UpgradeWizard&action=index';
        echo '<form name="redirect" action="' . $redirect_new_wizard . '"  method="POST">';
        $upgrade_directories_not_found = <<<eoq
\t<table cellpadding="3" cellspacing="0" border="0">
\t\t<tr>
\t\t\t<th colspan="2" align="left">
\t\t\t\t<span class='error'><b>'Upload file missing or has been deleted. Refresh the page to go back to UpgradeWizard start'</b></span>
\t\t\t</th>
\t\t</tr>
\t</table>
eoq;
        $uwMain = $upgrade_directories_not_found;
        return '';
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:31,代码来源:commit.php


示例2: langPackUnpack

function langPackUnpack($unpack_type, $full_file)
{
    global $sugar_config;
    global $base_upgrade_dir;
    global $base_tmp_upgrade_dir;
    $manifest = array();
    if (!empty($full_file)) {
        $base_filename = pathinfo(urldecode($full_file), PATHINFO_FILENAME);
    } else {
        return "Empty filename supplied";
    }
    $manifest_file = extractManifest($full_file, $base_tmp_upgrade_dir);
    if ($unpack_type == 'module') {
        $license_file = extractFile($full_file, 'LICENSE.txt', $base_tmp_upgrade_dir);
    }
    if (is_file($manifest_file)) {
        if ($unpack_type == 'module' && is_file($license_file)) {
            copy($license_file, $base_upgrade_dir . '/' . $unpack_type . '/' . $base_filename . "-license.txt");
        }
        copy($manifest_file, $base_upgrade_dir . '/' . $unpack_type . '/' . $base_filename . "-manifest.php");
        require_once $manifest_file;
        validate_manifest($manifest);
        $upgrade_zip_type = $manifest['type'];
        mkdir_recursive("{$base_upgrade_dir}/{$upgrade_zip_type}");
        $target_path = "{$base_upgrade_dir}/{$upgrade_zip_type}/{$base_filename}";
        $target_manifest = $target_path . "-manifest.php";
        if (isset($manifest['icon']) && $manifest['icon'] != "") {
            $icon_location = extractFile($full_file, $manifest['icon'], $base_tmp_upgrade_dir);
            $path_parts = pathinfo($icon_location);
            copy($icon_location, $target_path . "-icon." . $path_parts['extension']);
        }
        // move file from uploads to cache
        // FIXME: where should it be?
        if (copy($full_file, $target_path . ".zip")) {
            copy($manifest_file, $target_manifest);
            unlink($full_file);
            // remove tempFile
            return "The file {$base_filename} has been uploaded.<br>\n";
        } else {
            unlinkTempFiles($manifest_file, $full_file);
            return "There was an error uploading the file, please try again!<br>\n";
        }
    } else {
        die("The zip file is missing a manifest.php file.  Cannot proceed.");
    }
    unlinkTempFiles($manifest_file, '');
}
开发者ID:stefano6310,项目名称:SuiteCRM,代码行数:47,代码来源:install_utils.php


示例3: setNamePreview

        document.getElementById('default_decimal_seperator').value = ',';        
     }else{
        document.getElementById('sigDigits').value = '2';   
        document.getElementById('default_number_grouping_seperator').value = ',';
        document.getElementById('default_decimal_seperator').value = '.';        
     } 
     
     
        
    }
EOQ;
//hide this in typical mode
if (isset($_SESSION['install_type']) && !empty($_SESSION['install_type']) && strtolower($_SESSION['install_type']) == 'custom') {
    $out .= <<<EOQ
    function setNamePreview(){
        setPreview();
        document.getElementById('nameTargetDiv').innerHTML = document.getElementById('nameTarget').value;
    }
    setNamePreview();
EOQ;
}
$out .= <<<EOQ
</script>

</body>
</html>
EOQ;
echo $out;
unlinkTempFiles('', '');
////    END PAGEOUTPUT
///////////////////////////////////////////////////////////////////////////////
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:31,代码来源:localization.php


示例4: langPackUnpack

function langPackUnpack($unpack_type = 'langpack', $full_file = '')
{
    global $sugar_config;
    global $base_upgrade_dir;
    global $base_tmp_upgrade_dir;
    $manifest = array();
    if (!empty($full_file)) {
        $tempFile = $full_file;
        $base_filename = urldecode($tempFile);
        $base_filename = preg_replace("#\\\\#", "/", $base_filename);
        $base_filename = basename($base_filename);
    } else {
        $tempFile = getcwd() . '/' . $sugar_config['upload_dir'] . $_FILES['language_pack']['name'];
        $base_filename = $_FILES['language_pack']['name'];
    }
    $manifest_file = extractManifest($tempFile, $base_tmp_upgrade_dir);
    if ($unpack_type == 'module') {
        $license_file = extractFile($tempFile, 'LICENSE.txt', $base_tmp_upgrade_dir);
    }
    if (is_file($manifest_file)) {
        if ($unpack_type == 'module' && is_file($license_file)) {
            copy($license_file, getcwd() . '/' . $sugar_config['upload_dir'] . 'upgrades/' . $unpack_type . '/' . remove_file_extension($base_filename) . "-license.txt");
        }
        copy($manifest_file, getcwd() . '/' . $sugar_config['upload_dir'] . 'upgrades/' . $unpack_type . '/' . remove_file_extension($base_filename) . "-manifest.php");
        require_once $manifest_file;
        validate_manifest($manifest);
        $upgrade_zip_type = $manifest['type'];
        // exclude the bad permutations
        /*if($upgrade_zip_type != "langpack") {
              unlinkTempFiles($manifest_file, $tempFile);
              die( "You can only upload module packs, theme packs, and language packs on this page." );
          }*/
        //$base_filename = urldecode( $_REQUEST['language_pack_escaped'] );
        $base_filename = preg_replace("#\\\\#", "/", $base_filename);
        $base_filename = basename($base_filename);
        mkdir_recursive("{$base_upgrade_dir}/{$upgrade_zip_type}");
        $target_path = getcwd() . "/{$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'], $base_tmp_upgrade_dir);
            $path_parts = pathinfo($icon_location);
            copy($icon_location, remove_file_extension($target_path) . "-icon." . $path_parts['extension']);
        }
        // move file from cache/upload to cache/upload/langpack
        if (copy($tempFile, $target_path)) {
            copy($manifest_file, $target_manifest);
            unlink($tempFile);
            // remove tempFile
            return "The file {$base_filename} has been uploaded.<br>\n";
        } else {
            unlinkTempFiles($manifest_file, $tempFile);
            return "There was an error uploading the file, please try again!<br>\n";
        }
    } else {
        die("The zip file is missing a manifest.php file.  Cannot proceed.");
    }
    unlinkTempFiles($manifest_file, '');
}
开发者ID:klr2003,项目名称:sourceread,代码行数:58,代码来源:install_utils.php


示例5: preflightCheck

function preflightCheck()
{
    require_once 'modules/UpgradeWizard/uw_files.php';
    global $sugar_config;
    global $mod_strings;
    global $sugar_version;
    if (!isset($sugar_version) || empty($sugar_version)) {
        require_once './sugar_version.php';
    }
    unset($_SESSION['rebuild_relationships']);
    unset($_SESSION['rebuild_extensions']);
    // don't bother if are rechecking
    $manualDiff = array();
    if (!isset($_SESSION['unzip_dir']) || empty($_SESSION['unzip_dir'])) {
        logThis('unzipping files in upgrade archive...');
        $errors = array();
        $base_upgrade_dir = $sugar_config['upload_dir'] . "/upgrades";
        $base_tmp_upgrade_dir = "{$base_upgrade_dir}/temp";
        $unzip_dir = '';
        //Following is if User logged out unexpectedly and then logged into UpgradeWizard again.
        //also come up with mechanism to read from upgrade-progress file.
        if (!isset($_SESSION['install_file']) || empty($_SESSION['install_file']) || !is_file($_SESSION['install_file'])) {
            if (file_exists(clean_path($base_tmp_upgrade_dir)) && ($handle = opendir(clean_path($base_tmp_upgrade_dir)))) {
                while (false !== ($file = readdir($handle))) {
                    if ($file != "." && $file != "..") {
                        //echo $base_tmp_upgrade_dir."/".$file.'</br>';
                        if (is_file($base_tmp_upgrade_dir . "/" . $file . "/manifest.php")) {
                            require_once $base_tmp_upgrade_dir . "/" . $file . "/manifest.php";
                            $package_name = $manifest['copy_files']['from_dir'];
                            //echo file_exists($base_tmp_upgrade_dir."/".$file."/".$package_name).'</br>';
                            if (file_exists($base_tmp_upgrade_dir . "/" . $file . "/" . $package_name) && file_exists($base_tmp_upgrade_dir . "/" . $file . "/scripts") && file_exists($base_tmp_upgrade_dir . "/" . $file . "/manifest.php")) {
                                //echo 'Yeah this the directory '. $base_tmp_upgrade_dir."/".$file;
                                $unzip_dir = $base_tmp_upgrade_dir . "/" . $file;
                                if (file_exists($sugar_config['upload_dir'] . '/upgrades/patch/' . $package_name . '.zip')) {
                                    $_SESSION['install_file'] = $sugar_config['upload_dir'] . '/upgrades/patch/' . $package_name . '.zip';
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
        if (!isset($_SESSION['install_file']) || empty($_SESSION['install_file'])) {
            unlinkTempFiles();
            resetUwSession();
            echo 'Upload File not found so redirecting to Upgrade Start ';
            $redirect_new_wizard = $sugar_config['site_url'] . '/index.php?module=UpgradeWizard&action=index';
            echo '<form name="redirect" action="' . $redirect_new_wizard . '"  method="POST">';
            $upgrade_directories_not_found = <<<eoq
\t<table cellpadding="3" cellspacing="0" border="0">
\t\t<tr>
\t\t\t<th colspan="2" align="left">
\t\t\t\t<span class='error'><b>'Upload file missing or has been deleted. Refresh the page to go back to UpgradeWizard start'</b></span>
\t\t\t</th>
\t\t</tr>
\t</table>
eoq;
            $uwMain = $upgrade_directories_not_found;
            return '';
        }
        $install_file = urldecode($_SESSION['install_file']);
        $show_files = true;
        if (empty($unzip_dir)) {
            $unzip_dir = mk_temp_dir($base_tmp_upgrade_dir);
        }
        $zip_from_dir = ".";
        $zip_to_dir = ".";
        $zip_force_copy = array();
        if (!$unzip_dir) {
            logThis('Could not create a temporary directory using mk_temp_dir( $base_tmp_upgrade_dir )');
            die($mod_strings['ERR_UW_NO_CREATE_TMP_DIR']);
        }
        //double check whether unzipped .
        if (file_exists($unzip_dir . "/scripts") && file_exists($unzip_dir . "/manifest.php")) {
            //already unzipped
        } else {
            unzip($install_file, $unzip_dir);
        }
        // assumption -- already validated manifest.php at time of upload
        require_once "{$unzip_dir}/manifest.php";
        if (isset($manifest['copy_files']['from_dir']) && $manifest['copy_files']['from_dir'] != "") {
            $zip_from_dir = $manifest['copy_files']['from_dir'];
        }
        if (isset($manifest['copy_files']['to_dir']) && $manifest['copy_files']['to_dir'] != "") {
            $zip_to_dir = $manifest['copy_files']['to_dir'];
        }
        if (isset($manifest['copy_files']['force_copy']) && $manifest['copy_files']['force_copy'] != "") {
            $zip_force_copy = $manifest['copy_files']['force_copy'];
        }
        if (isset($manifest['version'])) {
            $version = $manifest['version'];
        }
        if (!is_writable("config.php")) {
            return $mod_strings['ERR_UW_CONFIG'];
        }
        $_SESSION['unzip_dir'] = clean_path($unzip_dir);
        $_SESSION['zip_from_dir'] = clean_path($zip_from_dir);
        //logThis('unzip done.');
    } else {
//.........这里部分代码省略.........
开发者ID:Terradex,项目名称:sugar,代码行数:101,代码来源:uw_utils.php


示例6: commitAjaxFinalTouches

/**
 * does post-post-install stuff
 * @param array persistence
 * @return array persistence
 */
function commitAjaxFinalTouches($persistence)
{
    global $current_user;
    global $locale;
    global $mod_strings;
    global $sugar_version;
    if (empty($sugar_version)) {
        require 'sugar_version.php';
    }
    // convert to UTF8 if needed
    if (!empty($persistence['allTables'])) {
        executeConvertTablesSql($db->dbType, $persistence['allTables']);
    }
    // rebuild
    logThis('Performing UWrebuild()...');
    UWrebuild();
    logThis('UWrebuild() done.');
    // upgrade history
    registerUpgrade($persistence);
    // flag to say upgrade has completed
    $persistence['upgrade_complete'] = true;
    // reminders if needed
    ///////////////////////////////////////////////////////////////////////////////
    ////	HANDLE REMINDERS
    if (count($persistence['skipped_files']) > 0) {
        $desc = $mod_strings['LBL_UW_COMMIT_ADD_TASK_OVERVIEW'] . "\n\n";
        $desc .= $mod_strings['LBL_UW_COMMIT_ADD_TASK_DESC_1'];
        $desc .= $persistence['uw_restore_dir'] . "\n\n";
        $desc .= $mod_strings['LBL_UW_COMMIT_ADD_TASK_DESC_2'] . "\n\n";
        foreach ($persistence['skipped_files'] as $file) {
            $desc .= $file . "\n";
        }
        //MFH #13468
        $nowDate = gmdate($timedate->dbDateFormat);
        $nowTime = gmdate($timedate->dbTimeFormat);
        $nowDateTime = $nowDate . ' ' . $nowTime;
        if ($_REQUEST['addTaskReminder'] == 'remind') {
            logThis('Adding Task for admin for manual merge.');
            $task = new Task();
            $task->name = $mod_strings['LBL_UW_COMMIT_ADD_TASK_NAME'];
            $task->description = $desc;
            $task->date_due = $nowDate;
            $task->time_due = $nowTime;
            $task->priority = 'High';
            $task->status = 'Not Started';
            $task->assigned_user_id = $current_user->id;
            $task->created_by = $current_user->id;
            $task->date_entered = $nowDateTime;
            $task->date_modified = $nowDateTime;
            $task->save();
        }
        if ($_REQUEST['addEmailReminder'] == 'remind') {
            logThis('Sending Reminder for admin for manual merge.');
            $email = new Email();
            $email->assigned_user_id = $current_user->id;
            $email->name = $mod_strings['LBL_UW_COMMIT_ADD_TASK_NAME'];
            $email->description = $desc;
            $email->description_html = nl2br($desc);
            $email->from_name = $current_user->full_name;
            $email->from_addr = $current_user->email1;
            $email->to_addrs_arr = $email->parse_addrs($current_user->email1, '', '', '');
            $email->cc_addrs_arr = array();
            $email->bcc_addrs_arr = array();
            $email->date_entered = $nowDateTime;
            $email->date_modified = $nowDateTime;
            $email->send();
            $email->save();
        }
    }
    ////	HANDLE REMINDERS
    ///////////////////////////////////////////////////////////////////////////////
    // clean up
    unlinkTempFiles();
    ob_start();
    echo 'done';
    ob_flush();
    return $persistence;
}
开发者ID:klr2003,项目名称:sourceread,代码行数:83,代码来源:uw_ajax.php


示例7: fix_dropdown_list

        fix_dropdown_list();
    }
    set_upgrade_progress('end', 'in_progress', 'end', 'in_progress');
    /////////////////////////Old Logger settings///////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////
    if (function_exists('deleteCache')) {
        set_upgrade_progress('end', 'in_progress', 'deleteCache', 'in_progress');
        @deleteCache();
        set_upgrade_progress('end', 'in_progress', 'deleteCache', 'done');
    }
    ///////////////////////////////////////////////////////////////////////////////
    ////	TAKE OUT TRASH
    if (empty($errors)) {
        set_upgrade_progress('end', 'in_progress', 'unlinkingfiles', 'in_progress');
        logThis('Taking out the trash, unlinking temp files.', $path);
        unlinkTempFiles(true);
        set_upgrade_progress('end', 'in_progress', 'unlinkingfiles', 'done');
    }
    ///////////////////////////////////////////////////////////////////////////////
    ////	HANDLE REMINDERS
    if (empty($errors)) {
        commitHandleReminders($skippedFiles, $path);
    }
    if (file_exists(clean_path(getcwd()) . '/original451files')) {
        rmdir_recursive(clean_path(getcwd()) . '/original451files');
    }
    require_once 'modules/Administration/Administration.php';
}
//Also set the tracker settings if  flavor conversion ce->pro or ce->ent
if (isset($_SESSION['current_db_version']) && isset($_SESSION['target_db_version'])) {
    if ($_SESSION['current_db_version'] == $_SESSION['target_db_version']) {
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:silentUpgrade.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP unlinkUWTempFiles函数代码示例发布时间:2022-05-23
下一篇:
PHP unlink函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap