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


PHP pre_install函数代码示例

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


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

示例1: commitPatch

function commitPatch($unlink = false, $type = 'patch')
{
    require_once 'ModuleInstall/ModuleInstaller.php';
    require_once 'include/entryPoint.php';
    global $mod_strings;
    global $base_upgrade_dir;
    global $base_tmp_upgrade_dir;
    global $db;
    $GLOBALS['db'] = $db;
    $errors = array();
    $files = array();
    global $current_user;
    $current_user = new User();
    $current_user->is_admin = '1';
    $old_mod_strings = $mod_strings;
    if (is_dir($base_upgrade_dir)) {
        $files = findAllFiles("{$base_upgrade_dir}/{$type}", $files);
        $mi = new ModuleInstaller();
        $mi->silent = true;
        $mod_strings = return_module_language('en', "Administration");
        foreach ($files as $file) {
            if (!preg_match('#.*\\.zip\\$#', $file)) {
                continue;
            }
            // handle manifest.php
            $target_manifest = remove_file_extension($file) . '-manifest.php';
            include $target_manifest;
            $unzip_dir = mk_temp_dir($base_tmp_upgrade_dir);
            unzip($file, $unzip_dir);
            if (file_exists("{$unzip_dir}/scripts/pre_install.php")) {
                require_once "{$unzip_dir}/scripts/pre_install.php";
                pre_install();
            }
            if (isset($manifest['copy_files']['from_dir']) && $manifest['copy_files']['from_dir'] != "") {
                $zip_from_dir = $manifest['copy_files']['from_dir'];
            }
            $source = "{$unzip_dir}/{$zip_from_dir}";
            $dest = getcwd();
            copy_recursive($source, $dest);
            if (file_exists("{$unzip_dir}/scripts/post_install.php")) {
                require_once "{$unzip_dir}/scripts/post_install.php";
                post_install();
            }
            $new_upgrade = new UpgradeHistory();
            $new_upgrade->filename = $file;
            $new_upgrade->md5sum = md5_file($file);
            $new_upgrade->type = $manifest['type'];
            $new_upgrade->version = $manifest['version'];
            $new_upgrade->status = "installed";
            //$new_upgrade->author        = $manifest['author'];
            $new_upgrade->name = $manifest['name'];
            $new_upgrade->description = $manifest['description'];
            $serial_manifest = array();
            $serial_manifest['manifest'] = isset($manifest) ? $manifest : '';
            $serial_manifest['installdefs'] = isset($installdefs) ? $installdefs : '';
            $serial_manifest['upgrade_manifest'] = isset($upgrade_manifest) ? $upgrade_manifest : '';
            $new_upgrade->manifest = base64_encode(serialize($serial_manifest));
            $new_upgrade->save();
            unlink($file);
        }
        //rof
    }
    //fi
    $mod_strings = $old_mod_strings;
}
开发者ID:stefano6310,项目名称:SuiteCRM,代码行数:65,代码来源:install_utils.php

示例2: commitMakeBackupFiles

     $errors = commitMakeBackupFiles($rest_dir, $install_file, $unzip_dir, $zip_from_dir, array());
     set_upgrade_progress('commit', 'in_progress', 'commitMakeBackupFiles', 'done');
 }
 //Need to make sure we have the matching copy of SetValueAction for static/instance method matching
 if (file_exists("include/Expressions/Actions/SetValueAction.php")) {
     require_once "include/Expressions/Actions/SetValueAction.php";
 }
 ///////////////////////////////////////////////////////////////////////////////
 ////	HANDLE PREINSTALL SCRIPTS
 if (empty($errors)) {
     $file = "{$unzip_dir}/" . constant('SUGARCRM_PRE_INSTALL_FILE');
     if (is_file($file)) {
         include $file;
         if (!didThisStepRunBefore('commit', 'pre_install')) {
             set_upgrade_progress('commit', 'in_progress', 'pre_install', 'in_progress');
             pre_install();
             set_upgrade_progress('commit', 'in_progress', 'pre_install', 'done');
         }
     }
 }
 //Clean smarty from cache
 $cachedir = sugar_cached('smarty');
 if (is_dir($cachedir)) {
     $allModFiles = array();
     $allModFiles = findAllFiles($cachedir, $allModFiles);
     foreach ($allModFiles as $file) {
         //$file_md5_ref = str_replace(clean_path(getcwd()),'',$file);
         if (file_exists($file)) {
             unlink($file);
         }
     }
开发者ID:vsanth,项目名称:dynamic-crm,代码行数:31,代码来源:silentUpgrade_step1.php

示例3: get_required_upgrades

function get_required_upgrades($soapclient, $session)
{
    global $sugar_config, $sugar_version;
    require_once 'vendor/nusoap//nusoap.php';
    $errors = array();
    $upgrade_history = new UpgradeHistory();
    $upgrade_history->disable_row_level_security = true;
    $installeds = $upgrade_history->getAllOrderBy('date_entered ASC');
    $history = array();
    require_once 'soap/SoapError.php';
    $error = new SoapError();
    foreach ($installeds as $installed) {
        $history[] = array('id' => $installed->id, 'filename' => $installed->filename, 'md5' => $installed->md5sum, 'type' => $installed->type, 'status' => $installed->status, 'version' => $installed->version, 'date_entered' => $installed->date_entered, 'error' => $error->get_soap_array());
    }
    $result = $soapclient->call('get_required_upgrades', array('session' => $session, 'client_upgrade_history' => $history, 'client_version' => $sugar_version));
    $tempdir_parent = create_cache_directory("disc_client");
    $temp_dir = tempnam($tempdir_parent, "sug");
    sugar_mkdir($temp_dir, 0775);
    $upgrade_installed = false;
    if (empty($soapclient->error_str) && $result['error']['number'] == 0) {
        foreach ($result['upgrade_history_list'] as $upgrade) {
            $file_result = $soapclient->call('get_encoded_file', array('session' => $session, 'filename' => $upgrade['filename']));
            if (empty($soapclient->error_str) && $result['error']['number'] == 0) {
                if ($file_result['md5'] == $upgrade['md5']) {
                    $newfile = write_encoded_file($file_result, $temp_dir);
                    unzip($newfile, $temp_dir);
                    global $unzip_dir;
                    $unzip_dir = $temp_dir;
                    if (file_exists("{$temp_dir}/manifest.php")) {
                        require_once "{$temp_dir}/manifest.php";
                        global $manifest_arr;
                        $manifest_arr = $manifest;
                        if (!isset($manifest['offline_client_applicable']) || $manifest['offline_client_applicable'] == true || $manifest['offline_client_applicable'] == 'true') {
                            if (file_exists("{$temp_dir}/scripts/pre_install.php")) {
                                require_once "{$temp_dir}/scripts/pre_install.php";
                                pre_install();
                            }
                            if (isset($manifest['copy_files']['from_dir']) && $manifest['copy_files']['from_dir'] != "") {
                                $zip_from_dir = $manifest['copy_files']['from_dir'];
                            }
                            $source = "{$temp_dir}/{$zip_from_dir}";
                            $dest = getcwd();
                            copy_recursive($source, $dest);
                            if (file_exists("{$temp_dir}/scripts/post_install.php")) {
                                require_once "{$temp_dir}/scripts/post_install.php";
                                post_install();
                            }
                            //save newly installed upgrade
                            $new_upgrade = new UpgradeHistory();
                            $new_upgrade->filename = $upgrade['filename'];
                            $new_upgrade->md5sum = $upgrade['md5'];
                            $new_upgrade->type = $upgrade['type'];
                            $new_upgrade->version = $upgrade['version'];
                            $new_upgrade->status = "installed";
                            $new_upgrade->save();
                            $upgrade_installed = true;
                        }
                    }
                }
            }
        }
    }
    return $upgrade_installed;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:64,代码来源:disc_client_utils.php


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