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


PHP DupUtil::get_microtime方法代码示例

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


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

示例1: LIKE

    DUPX_Log::Error("No tables where created during step 1 of the install.  Please review the installer-log.txt file for sql error messages.\n\t\tYou may have to manually run the installer-data.sql with a tool like phpmyadmin to validate the data input.  If you have enabled compatibility mode\n\t\tduring the package creation process then the database server version your using may not be compatible with this script.\n");
}
//DATA CLEANUP: Perform Transient Cache Cleanup
//Remove all duplicator entries and record this one since this is a new install.
$dbdelete_count = 0;
@mysqli_query($dbh, "DELETE FROM `{$GLOBALS['FW_TABLEPREFIX']}duplicator_packages`");
$dbdelete_count1 = @mysqli_affected_rows($dbh) or 0;
@mysqli_query($dbh, "DELETE FROM `{$GLOBALS['FW_TABLEPREFIX']}options` WHERE `option_name` LIKE ('_transient%') OR `option_name` LIKE ('_site_transient%')");
$dbdelete_count2 = @mysqli_affected_rows($dbh) or 0;
$dbdelete_count = abs($dbdelete_count1) + abs($dbdelete_count2);
DUPX_Log::Info("Removed '{$dbdelete_count}' cache/transient rows");
//Reset Duplicator Options
foreach ($GLOBALS['FW_OPTS_DELETE'] as $value) {
    mysqli_query($dbh, "DELETE FROM `{$GLOBALS['FW_TABLEPREFIX']}options` WHERE `option_name` = '{$value}'");
}
@mysqli_close($dbh);
$profile_end = DupUtil::get_microtime();
DUPX_Log::Info("\nSECTION RUNTIME: " . DupUtil::elapsed_time($profile_end, $profile_start));
//FINAL RESULTS
$ajax1_end = DupUtil::get_microtime();
$ajax1_sum = DupUtil::elapsed_time($ajax1_end, $ajax1_start);
DUPX_Log::Info("\n{$GLOBALS['SEPERATOR1']}");
DUPX_Log::Info('STEP1 COMPLETE @ ' . @date('h:i:s') . " - TOTAL RUNTIME: {$ajax1_sum}");
DUPX_Log::Info("{$GLOBALS['SEPERATOR1']}");
$JSON['pass'] = 1;
$JSON['table_count'] = $dbtable_count;
$JSON['table_rows'] = $dbtable_rows;
$JSON['query_errs'] = $dbquery_errs;
echo json_encode($JSON);
error_reporting($ajax1_error_level);
die('');
开发者ID:DIESELOK,项目名称:GH-Frontend-5,代码行数:31,代码来源:ajax.step1.php

示例2: load

 /**
  * LOAD
  * Begins the processing for replace logic
  * @param mysql  $conn 		 The db connection object
  * @param array  $list       Key value pair of 'search' and 'replace' arrays
  * @param array  $tables     The tables we want to look at.
  * @return array Collection of information gathered during the run.
  */
 public static function load($conn, $list = array(), $tables = array(), $cols = array())
 {
     $exclude_cols = $cols;
     $report = array('scan_tables' => 0, 'scan_rows' => 0, 'scan_cells' => 0, 'updt_tables' => 0, 'updt_rows' => 0, 'updt_cells' => 0, 'errsql' => array(), 'errser' => array(), 'errkey' => array(), 'errsql_sum' => 0, 'errser_sum' => 0, 'errkey_sum' => 0, 'time' => '', 'err_all' => 0);
     $profile_start = DupUtil::get_microtime();
     if (is_array($tables) && !empty($tables)) {
         foreach ($tables as $table) {
             $report['scan_tables']++;
             $columns = array();
             // Get a list of columns in this table
             $fields = mysqli_query($conn, 'DESCRIBE ' . $table);
             while ($column = mysqli_fetch_array($fields)) {
                 $columns[$column['Field']] = $column['Key'] == 'PRI' ? true : false;
             }
             // Count the number of rows we have in the table if large we'll split into blocks, This is a mod from Simon Wheatley
             $row_count = mysqli_query($conn, 'SELECT COUNT(*) FROM ' . $table);
             $rows_result = mysqli_fetch_array($row_count);
             @mysqli_free_result($row_count);
             $row_count = $rows_result[0];
             if ($row_count == 0) {
                 continue;
             }
             $page_size = 25000;
             $pages = ceil($row_count / $page_size);
             for ($page = 0; $page < $pages; $page++) {
                 $current_row = 0;
                 $start = $page * $page_size;
                 $end = $start + $page_size;
                 // Grab the content of the table
                 $data = mysqli_query($conn, sprintf('SELECT * FROM %s LIMIT %d, %d', $table, $start, $end));
                 if (!$data) {
                     $report['errsql'][] = mysqli_error($conn);
                 }
                 //Loops every row
                 while ($row = mysqli_fetch_array($data)) {
                     $report['scan_rows']++;
                     $current_row++;
                     $upd_col = array();
                     $upd_sql = array();
                     $where_sql = array();
                     $upd = false;
                     $serial_err = 0;
                     //Loops every cell
                     foreach ($columns as $column => $primary_key) {
                         if (in_array($column, $exclude_cols)) {
                             continue;
                         }
                         $report['scan_cells']++;
                         $edited_data = $data_to_fix = $row[$column];
                         $base64coverted = false;
                         //Only replacing string values
                         if (!is_numeric($row[$column])) {
                             //Base 64 detection
                             if (base64_decode($row[$column], true)) {
                                 $decoded = base64_decode($row[$column], true);
                                 if (self::is_serialized($decoded)) {
                                     $edited_data = $decoded;
                                     $base64coverted = true;
                                 }
                             }
                             //Replace logic - level 1: simple check on basic serilized strings
                             foreach ($list as $item) {
                                 $edited_data = self::recursive_unserialize_replace($item['search'], $item['replace'], $edited_data);
                             }
                             //Replace logic - level 2: repair larger/complex serilized strings
                             $serial_check = self::fix_serial_string($edited_data);
                             if ($serial_check['fixed']) {
                                 $edited_data = $serial_check['data'];
                             } elseif ($serial_check['tried'] && !$serial_check['fixed']) {
                                 $serial_err++;
                             }
                         }
                         //Change was made
                         if ($edited_data != $data_to_fix || $serial_err > 0) {
                             $report['updt_cells']++;
                             //Base 64 encode
                             if ($base64coverted) {
                                 $edited_data = base64_encode($edited_data);
                             }
                             $upd_col[] = $column;
                             $upd_sql[] = $column . ' = "' . mysqli_real_escape_string($conn, $edited_data) . '"';
                             $upd = true;
                         }
                         if ($primary_key) {
                             $where_sql[] = $column . ' = "' . mysqli_real_escape_string($conn, $data_to_fix) . '"';
                         }
                     }
                     //PERFORM ROW UPDATE
                     if ($upd && !empty($where_sql)) {
                         $sql = "UPDATE `{$table}` SET " . implode(', ', $upd_sql) . ' WHERE ' . implode(' AND ', array_filter($where_sql));
                         $result = mysqli_query($conn, $sql) or $report['errsql'][] = mysqli_error($conn);
                         if ($result) {
//.........这里部分代码省略.........
开发者ID:batruji,项目名称:metareading,代码行数:101,代码来源:ajax.step2.php

示例3: load

 /**
  * LOAD
  * Begins the processing for replace logic
  * @param mysql  $conn 		 The db connection object
  * @param array  $list       Key value pair of 'search' and 'replace' arrays
  * @param array  $tables     The tables we want to look at.
  * @return array Collection of information gathered during the run.
  */
 public static function load($conn, $list = array(), $tables = array(), $cols = array(), $fullsearch = false)
 {
     $exclude_cols = $cols;
     $report = array('scan_tables' => 0, 'scan_rows' => 0, 'scan_cells' => 0, 'updt_tables' => 0, 'updt_rows' => 0, 'updt_cells' => 0, 'errsql' => array(), 'errser' => array(), 'errkey' => array(), 'errsql_sum' => 0, 'errser_sum' => 0, 'errkey_sum' => 0, 'time' => '', 'err_all' => 0);
     $walk_function = create_function('&$str', '$str = "`$str`";');
     $profile_start = DupUtil::get_microtime();
     if (is_array($tables) && !empty($tables)) {
         foreach ($tables as $table) {
             $report['scan_tables']++;
             $columns = array();
             // Get a list of columns in this table
             $fields = mysqli_query($conn, 'DESCRIBE ' . $table);
             while ($column = mysqli_fetch_array($fields)) {
                 $columns[$column['Field']] = $column['Key'] == 'PRI' ? true : false;
             }
             // Count the number of rows we have in the table if large we'll split into blocks
             $row_count = mysqli_query($conn, "SELECT COUNT(*) FROM `{$table}`");
             $rows_result = mysqli_fetch_array($row_count);
             @mysqli_free_result($row_count);
             $row_count = $rows_result[0];
             if ($row_count == 0) {
                 DUPX_Log::Info("{$table}^ ({$row_count})");
                 continue;
             }
             $page_size = 25000;
             $offset = $page_size + 1;
             $pages = ceil($row_count / $page_size);
             // Grab the columns of the table.  Only grab text based columns because
             // they are the only data types that should allow any type of search/replace logic
             $colList = '*';
             $colMsg = '*';
             if (!$fullsearch) {
                 $colList = self::getTextColumns($conn, $table);
                 if ($colList != null && is_array($colList)) {
                     array_walk($colList, $walk_function);
                     $colList = implode(',', $colList);
                 }
                 $colMsg = empty($colList) ? '*' : '~';
             }
             if (empty($colList)) {
                 DUPX_Log::Info("{$table}^ ({$row_count})");
                 continue;
             } else {
                 DUPX_Log::Info("{$table}{$colMsg} ({$row_count})");
             }
             //Paged Records
             for ($page = 0; $page < $pages; $page++) {
                 $current_row = 0;
                 $start = $page * $page_size;
                 $end = $start + $page_size;
                 $sql = sprintf("SELECT {$colList} FROM `%s` LIMIT %d, %d", $table, $start, $offset);
                 $data = mysqli_query($conn, $sql);
                 if (!$data) {
                     $report['errsql'][] = mysqli_error($conn);
                 }
                 $scan_count = $row_count < $end ? $row_count : $end;
                 DUPX_Log::Info("\tScan => {$start} of {$scan_count}", 2);
                 //DEBUG ONLY:
                 //DUPX_Log::Info("\t{$sql}", 3);
                 //Loops every row
                 while ($row = mysqli_fetch_array($data)) {
                     $report['scan_rows']++;
                     $current_row++;
                     $upd_col = array();
                     $upd_sql = array();
                     $where_sql = array();
                     $upd = false;
                     $serial_err = 0;
                     //Loops every cell
                     foreach ($columns as $column => $primary_key) {
                         if (in_array($column, $exclude_cols)) {
                             continue;
                         }
                         $report['scan_cells']++;
                         $edited_data = $data_to_fix = $row[$column];
                         $base64coverted = false;
                         //Only replacing string values
                         if (!empty($row[$column]) && !is_numeric($row[$column])) {
                             //Base 64 detection
                             if (base64_decode($row[$column], true)) {
                                 $decoded = base64_decode($row[$column], true);
                                 if (self::is_serialized($decoded)) {
                                     $edited_data = $decoded;
                                     $base64coverted = true;
                                 }
                             }
                             //Replace logic - level 1: simple check on basic serilized strings
                             foreach ($list as $item) {
                                 $edited_data = self::recursive_unserialize_replace($item['search'], $item['replace'], $edited_data);
                             }
                             //Replace logic - level 2: repair larger/complex serilized strings
                             $serial_check = self::fix_serial_string($edited_data);
//.........这里部分代码省略.........
开发者ID:healthcommcore,项目名称:osnap,代码行数:101,代码来源:class.serializer.php


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