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


PHP post_install_progress函数代码示例

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


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

示例1: constant

     $file = "{$unzip_dir}/" . constant('SUGARCRM_POST_INSTALL_FILE');
     if (is_file($file)) {
         //set_upgrade_progress('commit','in_progress','post_install','in_progress');
         $progArray['post_install'] = 'in_progress';
         post_install_progress($progArray, 'set');
         global $moduleList;
         include $file;
         post_install();
         // cn: only run conversion if admin selects "Sugar runs SQL"
         if (!empty($_SESSION['allTables']) && $_SESSION['schema_change'] == 'sugar') {
             executeConvertTablesSql($_SESSION['allTables']);
         }
         //set process to done
         $progArray['post_install'] = 'done';
         //set_upgrade_progress('commit','in_progress','post_install','done');
         post_install_progress($progArray, 'set');
     }
 }
 //clean vardefs
 logThis('Performing UWrebuild()...', $path);
 ob_start();
 @UWrebuild();
 ob_end_clean();
 logThis('UWrebuild() done.', $path);
 logThis('begin check default permissions .', $path);
 checkConfigForPermissions();
 logThis('end check default permissions .', $path);
 logThis('begin check logger settings .', $path);
 checkLoggerSettings();
 logThis('begin check logger settings .', $path);
 logThis('begin check lead conversion settings .', $path);
开发者ID:vsanth,项目名称:dynamic-crm,代码行数:31,代码来源:silentUpgrade_step1.php

示例2: parseAndExecuteSqlFile

function parseAndExecuteSqlFile($sqlScript, $forStepQuery = '', $resumeFromQuery = '')
{
    global $sugar_config;
    $alterTableSchema = '';
    $sqlErrors = array();
    if (!isset($_SESSION['sqlSkippedQueries'])) {
        $_SESSION['sqlSkippedQueries'] = array();
    }
    $db =& DBManagerFactory::getInstance();
    $is_mysql = false;
    if ($sugar_config['dbconfig']['db_type'] == 'mysql') {
        $is_mysql = true;
    }
    if ($sugar_config['dbconfig']['db_type'] == 'oci8') {
        $db->query("CREATE OR REPLACE FUNCTION blob_to_clob (blob_in IN BLOB)\n\t\t\t\t\tRETURN CLOB\n\t\t\t\t\tAS\n\t\t\t\t\t  v_clob    CLOB;\n\t\t\t\t\t  v_varchar VARCHAR2(32767);\n\t\t\t\t\t  v_start   PLS_INTEGER := 1;\n\t\t\t\t\t  v_buffer  PLS_INTEGER := 32767;\n\t\t\t\t\tBEGIN\n\t\t\t\t\t  DBMS_LOB.CREATETEMPORARY(v_clob, TRUE);\n\t\t\t\t\t  \n\t\t\t\t\t  FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(blob_in) / v_buffer)\n\t\t\t\t\t  LOOP\n\t\t\t\t\t    \n\t\t\t\t\t     v_varchar := UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(blob_in, v_buffer, v_start));\n\t\t\t\t\t \n\t\t\t\t\t           DBMS_LOB.WRITEAPPEND(v_clob, LENGTH(v_varchar), v_varchar);\n\t\t\t\t\t \n\t\t\t\t\t        v_start := v_start + v_buffer;\n\t\t\t\t\t    END LOOP;\n\t\t\t\t\t    \n\t\t\t\t\t   RETURN v_clob;\n\t\t\t\t\t  \n\t\t\t\t\tEND blob_to_clob;");
    }
    if (strpos($resumeFromQuery, ",") != false) {
        $resumeFromQuery = explode(",", $resumeFromQuery);
        if (is_array($resumeFromQuery)) {
            //print_r('RES ARRAY '.$resumeFromQuery[0].'</br>');
        }
    }
    if (file_exists($sqlScript)) {
        $fp = fopen($sqlScript, 'r');
        $contents = fread($fp, filesize($sqlScript));
        $anyScriptChanges = $contents;
        $resumeAfterFound = false;
        if (rewind($fp)) {
            $completeLine = '';
            $count = 0;
            while ($line = fgets($fp)) {
                if (strpos($line, '--') === false) {
                    $completeLine .= " " . trim($line);
                    if (strpos($line, ';') !== false) {
                        $query = '';
                        $query = str_replace(';', '', $completeLine);
                        //if resume from query is not null then find out from where
                        //it should start executing the query.
                        if ($query != null && $resumeFromQuery != null) {
                            if (!$resumeAfterFound) {
                                if (strpos($query, ",") != false) {
                                    $queArray = array();
                                    $queArray = explode(",", $query);
                                    for ($i = 0; $i < sizeof($resumeFromQuery); $i++) {
                                        if (strcmp(strtolower(trim($resumeFromQuery[$i])), strtolower(trim($queArray[$i]))) == 0) {
                                            //echo 'mat found '.$queArray[$i].'</br>';
                                            $resumeAfterFound = true;
                                        } else {
                                            $resumeAfterFound = false;
                                            break;
                                        }
                                    }
                                    //for
                                } elseif (strcmp(strtolower(trim($resumeFromQuery)), strtolower(trim($query))) == 0) {
                                    $resumeAfterFound = true;
                                }
                            }
                            if ($resumeAfterFound) {
                                $count++;
                            }
                            // if $count=1 means it is just found so skip the query. Run the next one
                            if ($query != null && $resumeAfterFound && $count > 1) {
                                $tableName = '';
                                if ($is_mysql) {
                                    $tableName = getAlterTable($query);
                                    if (!empty($tableName)) {
                                        $db->query('ALTER TABLE ' . $tableName . ' DISABLE KEYS');
                                    }
                                }
                                $db->query($query);
                                if (!empty($tableName)) {
                                    $db->query('ALTER TABLE ' . $tableName . ' ENABLE KEYS');
                                }
                                $progQuery[$forStepQuery] = $query;
                                post_install_progress($progQuery, $action = 'set');
                                if ($db->checkError()) {
                                    //put in the array to use later on
                                    $_SESSION['sqlSkippedQueries'][] = $query;
                                }
                            }
                            //if
                        } elseif ($query != null) {
                            $tableName = '';
                            if ($is_mysql) {
                                $tableName = getAlterTable($query);
                                if (!empty($tableName)) {
                                    $db->query('ALTER TABLE ' . $tableName . ' DISABLE KEYS');
                                }
                            }
                            $db->query($query);
                            if (!empty($tableName)) {
                                $db->query('ALTER TABLE ' . $tableName . ' ENABLE KEYS');
                            }
                            $progQuery[$forStepQuery] = $query;
                            post_install_progress($progQuery, $action = 'set');
                            if ($db->checkError()) {
                                //put in the array to use later on
                                $_SESSION['sqlSkippedQueries'][] = $query;
                            }
                        }
//.........这里部分代码省略.........
开发者ID:Terradex,项目名称:sugar,代码行数:101,代码来源:uw_utils.php

示例3: parseAndExecuteSqlFile

function parseAndExecuteSqlFile($sqlScript, $forStepQuery = '', $resumeFromQuery = '')
{
    global $sugar_config;
    $alterTableSchema = '';
    $sqlErrors = array();
    if (!isset($_SESSION['sqlSkippedQueries'])) {
        $_SESSION['sqlSkippedQueries'] = array();
    }
    $db = DBManagerFactory::getInstance();
    $disable_keys = $db->dbType == "mysql";
    // have to use old way for now for upgrades
    if (strpos($resumeFromQuery, ",") != false) {
        $resumeFromQuery = explode(",", $resumeFromQuery);
    }
    if (file_exists($sqlScript)) {
        $fp = fopen($sqlScript, 'r');
        $contents = stream_get_contents($fp);
        $anyScriptChanges = $contents;
        $resumeAfterFound = false;
        if (rewind($fp)) {
            $completeLine = '';
            $count = 0;
            while ($line = fgets($fp)) {
                if (strpos($line, '--') === false) {
                    $completeLine .= " " . trim($line);
                    if (strpos($line, ';') !== false) {
                        $query = '';
                        $query = str_replace(';', '', $completeLine);
                        //if resume from query is not null then find out from where
                        //it should start executing the query.
                        if ($query != null && $resumeFromQuery != null) {
                            if (!$resumeAfterFound) {
                                if (strpos($query, ",") != false) {
                                    $queArray = explode(",", $query);
                                    for ($i = 0; $i < sizeof($resumeFromQuery); $i++) {
                                        if (strcasecmp(trim($resumeFromQuery[$i]), trim($queArray[$i])) == 0) {
                                            $resumeAfterFound = true;
                                        } else {
                                            $resumeAfterFound = false;
                                            break;
                                        }
                                    }
                                    //for
                                } elseif (strcasecmp(trim($resumeFromQuery), trim($query)) == 0) {
                                    $resumeAfterFound = true;
                                }
                            }
                            if ($resumeAfterFound) {
                                $count++;
                            }
                            // if $count=1 means it is just found so skip the query. Run the next one
                            if ($query != null && $resumeAfterFound && $count > 1) {
                                $tableName = getAlterTable($query);
                                if ($disable_keys) {
                                    handleExecuteSqlKeys($db, $tableName, true);
                                }
                                $db->query($query);
                                if ($db->checkError()) {
                                    //put in the array to use later on
                                    $_SESSION['sqlSkippedQueries'][] = $query;
                                }
                                if ($disable_keys) {
                                    handleExecuteSqlKeys($db, $tableName, false);
                                }
                                $progQuery[$forStepQuery] = $query;
                                post_install_progress($progQuery, $action = 'set');
                            }
                            //if
                        } elseif ($query != null) {
                            $tableName = getAlterTable($query);
                            if ($disable_keys) {
                                handleExecuteSqlKeys($db, $tableName, true);
                            }
                            $db->query($query);
                            if ($disable_keys) {
                                handleExecuteSqlKeys($db, $tableName, false);
                            }
                            $progQuery[$forStepQuery] = $query;
                            post_install_progress($progQuery, $action = 'set');
                            if ($db->checkError()) {
                                //put in the array to use later on
                                $_SESSION['sqlSkippedQueries'][] = $query;
                            }
                        }
                        $completeLine = '';
                    }
                }
            }
            //while
        }
    }
}
开发者ID:omusico,项目名称:sugar_work,代码行数:92,代码来源:uw_utils.php

示例4: post_install

function post_install()
{
    global $unzip_dir;
    global $sugar_config;
    global $sugar_version;
    global $path;
    global $_SESSION;
    if (!isset($_SESSION['sqlSkippedQueries'])) {
        $_SESSION['sqlSkippedQueries'] = array();
    }
    initialize_session_vars();
    if (!isset($unzip_dir) || $unzip_dir == null) {
        $unzip_dir = $_SESSION['unzip_dir'];
    }
    _logThis('Entered post_install function.', $path);
    $self_dir = "{$unzip_dir}/scripts";
    ///////////////////////////////////////////////////////////////////////////
    ////	PUT DATABASE UPGRADE SCRIPT HANDLING HERE
    $new_sugar_version = getUpgradeVersion();
    $post_action = status_post_install_action('sql_query');
    if ($post_action != null) {
        if ($post_action != 'done') {
            //continue from where left in previous run
            runSqlFiles($sugar_version, $new_sugar_version, 'sql_query', $post_action);
            $currProg['sql_query'] = 'done';
            post_install_progress($currProg, 'set');
        }
    } else {
        //never ran before
        runSqlFiles($sugar_version, $new_sugar_version, 'sql_query');
        $currProg['sql_query'] = 'done';
        post_install_progress($currProg, 'set');
    }
    genericFunctions();
    upgradeDbAndFileVersion($new_sugar_version);
    //Remove jssource/src_files sub-directories if they still exist
    $jssource_dirs = array('jssource/src_files/include/javascript/ext-2.0', 'jssource/src_files/include/javascript/ext-1.1.1', 'jssource/src_files/include/javascript/yui');
    foreach ($jssource_dirs as $js_dir) {
        if (file_exists($js_dir)) {
            _logThis("Remove {$js_dir} directory");
            rmdir_recursive($js_dir);
            _logThis("Finished removing {$js_dir} directory");
        }
    }
}
开发者ID:JimMackin,项目名称:SuiteCRM-Build-Maker,代码行数:45,代码来源:post_install.php


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