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

PHP gzgets函数代码示例

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

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



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

示例1: fgets

 function fgets($fp, $len = 8192)
 {
     if ($this->has_gzip()) {
         return gzgets($fp, $len);
     }
     return fgets($fp, $len);
 }
开发者ID:bluedanbob,项目名称:wordpress,代码行数:7,代码来源:wordpress.php


示例2: fgetcsvWrapper

function fgetcsvWrapper($fp)
{
    global $gzipEnabled;
    if ($gzipEnabled) {
        // FIXME エスケープが必要なデータが来ると壊れるよーー
        $r = gzgets($fp, 4000);
        //        $r = "";
        //        $r = "";
        //        do {
        //            $r .= gzgets($fp, 4000);
        //        } while(mb_substr_count($r,'"') % 2 == 1);
        if ($r !== FALSE) {
            // 行末の\r\nは消してから分割
            $r = mb_ereg_replace("\r?\n\$", "", $r);
            return explode("\t", $r);
        } else {
            return FALSE;
        }
    } else {
        //         return fgetcsv($fp, 4000, "\t", '"');
        $r = fgets($fp, 4000);
        if ($r !== FALSE) {
            // 行末の\r\nは消してから分割
            $r = mb_ereg_replace("\r?\n\$", "", $r);
            return explode("\t", $r);
        } else {
            return FALSE;
        }
    }
}
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:30,代码来源:send.php


示例3: LoadBackUp

function LoadBackUp()
{
    global $SAMSConf;
    global $USERConf;
    $DB = new SAMSDB();
    $lang = "./lang/lang.{$SAMSConf->LANG}";
    require $lang;
    if ($USERConf->ToWebInterfaceAccess("C") != 1) {
        exit;
    }
    PageTop("reark_48.jpg", "{$backupbuttom_2_loadbase_LoadBackUp_1}");
    if (($finp = gzopen($_FILES['userfile']['tmp_name'], "r")) != NULL) {
        while (gzeof($finp) == 0) {
            $string = gzgets($finp, 10000);
            $QUERY = strtok($string, ";");
            if (strstr($QUERY, "#") == FALSE) {
                echo "{$QUERY}<BR>";
                $num_rows = $DB->samsdb_query($QUERY . ";");
            }
            $count++;
        }
    }
    print "<SCRIPT>\n";
    print "  parent.lframe.location.href=\"lframe.php\"; \n";
    print "</SCRIPT> \n";
}
开发者ID:ruNovel,项目名称:sams2,代码行数:26,代码来源:configbuttom_5_restore.php


示例4: import

 public function import()
 {
     // It might not look like it, but it is actually compatible to
     // uncompressed files.
     $gzFileHandler = gzopen($this->file, 'r');
     Model\DownloadIntent::delete_all();
     Model\DownloadIntentClean::delete_all();
     $batchSize = 1000;
     $batch = array();
     while (!gzeof($gzFileHandler)) {
         $line = gzgets($gzFileHandler);
         list($id, $user_agent_id, $media_file_id, $request_id, $accessed_at, $source, $context, $geo_area_id, $lat, $lng) = explode(",", $line);
         $batch[] = array($user_agent_id, $media_file_id, $request_id, $accessed_at, $source, $context, $geo_area_id, $lat, $lng);
         if (count($batch) >= $batchSize) {
             self::save_batch_to_db($batch);
             $batch = [];
         }
     }
     gzclose($gzFileHandler);
     // save last batch to db
     self::save_batch_to_db($batch);
     \Podlove\Analytics\DownloadIntentCleanup::cleanup_download_intents();
     \Podlove\Cache\TemplateCache::get_instance()->setup_purge();
     wp_redirect(admin_url('admin.php?page=podlove_imexport_migration_handle&status=success'));
     exit;
 }
开发者ID:johannes-mueller,项目名称:podlove-publisher,代码行数:26,代码来源:tracking_importer.php


示例5: gets

 /**
  * Read a line
  *
  * This function is identical to readLine except that trailing CR and LF characters
  * will be included in its return value
  *
  * @param   int bytes default 4096 Max. ammount of bytes to be read
  * @return  string Data read
  * @throws  io.IOException in case of an error
  */
 public function gets($bytes = 4096)
 {
     if (FALSE === ($result = gzgets($this->_fd, $bytes))) {
         throw new IOException('gets() cannot read ' . $bytes . ' bytes from ' . $this->uri);
     }
     return $result;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:17,代码来源:ZipFile.class.php


示例6: import_sql

 function import_sql($filename)
 {
     $handle = @gzopen($filename, "r");
     // can open normal files, too.
     $query = "";
     $queries = 0;
     while ($handle && !feof($handle)) {
         $line = gzgets($handle, 1024);
         // keep string manipulations sane
         if ($line != "" && substr($line, 0, 2) != "--") {
             // line doesnt start with comment
             $query .= $line;
             if (substr(trim($line), -1, 1) == ";") {
                 if (!mysql_query($query)) {
                     if (defined("DEBUG")) {
                         echo "MYSQL Error: " . mysql_error() . "<Br><br>in query: {$query}";
                     } else {
                         echo "MYSQL Error: " . mysql_error();
                     }
                 }
                 $query = "";
                 $queries++;
             }
         }
     }
     return true;
 }
开发者ID:Covert-Inferno,项目名称:eve-jackknife,代码行数:27,代码来源:update.php


示例7: restoreAction

 function restoreAction()
 {
     $backupFile = new UploadedFile("backupFile");
     if (!$backupFile->wasUploaded()) {
         return;
     }
     $gzipMode = $this->request->fileType == "gzip";
     $fileName = $backupFile->getTempName();
     $fp = $gzipMode ? gzopen($fileName, "r") : fopen($fileName, "r");
     $inString = false;
     $query = "";
     while (!feof($fp)) {
         $line = $gzipMode ? gzgets($fp) : fgets($fp);
         if (!$inString) {
             $isCommentLine = false;
             foreach (array("#", "--") as $commentTag) {
                 if (strpos($line, $commentTag) === 0) {
                     $isCommentLine = true;
                 }
             }
             if ($isCommentLine || trim($line) == "") {
                 continue;
             }
         }
         $deslashedLine = str_replace('\\', '', $line);
         if ((substr_count($deslashedLine, "'") - substr_count($deslashedLine, "\\'")) % 2) {
             $inString = !$inString;
         }
         $query .= $line;
         if (substr_compare(rtrim($line), ";", -1) == 0 && !$inString) {
             $this->database->sqlQuery($query);
             $query = "";
         }
     }
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:35,代码来源:SystemController.php


示例8: _Open

 /**
 * Open the file containing the backup data
 * @return String a String containing the DB Dump 
 * @access private
 */
 function _Open()
 {
     $fp = gzopen($this->filename, "rb") or die("Error. No se pudo abrir el archivo {$this->filename}");
     while (!gzeof($fp)) {
         $line = gzgets($fp, 1024);
         $SQL .= "{$line}";
     }
     gzclose($fp);
     return $SQL;
 }
开发者ID:Fengtalk,项目名称:yiqicms,代码行数:15,代码来源:iam_restore.php


示例9: __getline

 function __getline()
 {
     switch ($this->type) {
         case 'gz':
             $this->line = trim(gzgets($this->handle));
             break;
         case 'file':
             $this->line = trim(fgets($this->handle));
             break;
     }
 }
开发者ID:Sajaki,项目名称:wowroster_dev,代码行数:11,代码来源:luaparser.php


示例10: process

 public function process($dumpFile)
 {
     $handle = gzopen($dumpFile, "r");
     while ($line = gzgets($handle, 100000000)) {
         $data = json_decode(rtrim($line, ",\n"), true);
         if ($data !== null) {
             $entity = $this->entityDeserializer->deserialize($data);
             $this->entityHandler->handleEntity($entity);
         }
     }
     gzclose($handle);
 }
开发者ID:filbertkm,项目名称:wikibase-dump-processor,代码行数:12,代码来源:JsonDumpProcessor.php


示例11: readLine

 /**
  * Reads a line from a stream. If the optional argument is provided,
  * the method terminates reading on raching the specified length.
  *
  * @throws Opl_Stream_Exception
  * @param integer $length The maximum line length to read.
  * @return string The returned string.
  */
 public function readLine($length = null)
 {
     if (!is_resource($this->_stream)) {
         throw new Opl_Stream_Exception('Input stream is not opened.');
     }
     $content = gzgets($this->_stream, (int) $length, "\r\n");
     if ($content === false) {
         throw new Opl_Stream_Exception('Unable to read a line from an input stream.');
     }
     $this->_readingPtr += strlen($content);
     return $content;
 }
开发者ID:OPL,项目名称:Open-Power-Libs,代码行数:20,代码来源:Input.php


示例12: gzgetcont

function gzgetcont($f)
{
    $d = "";
    $fo = gzopen($f, 'r');
    if ($fo) {
        while (!gzeof($fo)) {
            $d .= gzgets($fo);
        }
    }
    gzclose($fo);
    return $d;
}
开发者ID:iamanony,项目名称:b64trans,代码行数:12,代码来源:func.php


示例13: uncompress

 /**
  * Uncompress a map file.
  *
  * @param string $path
  *
  * @return string
  */
 private static function uncompress($path)
 {
     if (!file_exists($path)) {
         throw new InvalidArgumentException('File does not exist');
     }
     $data = '';
     $gzo = gzopen($path, 'r');
     while ($line = gzgets($gzo, 1024)) {
         $data .= $line;
     }
     gzclose($gzo);
     return $data;
 }
开发者ID:arall,项目名称:cmsdiff,代码行数:20,代码来源:MapLoader.php


示例14: import_sql

 function import_sql($filename)
 {
     global $mysql;
     $handle = @gzopen($filename, "r");
     // can open normal files, too.
     $query = "";
     $queries = 0;
     while ($handle && !feof($handle)) {
         $line = gzgets($handle, 4096);
         // keep string manipulations sane
         if ($line != "" && substr($line, 0, 2) != "--") {
             // line doesnt start with comment
             $query .= $line;
             if (substr(trim($line), -2, 2) == ");") {
                 $query = str_replace("NOT EXISTS `", "NOT EXISTS `" . DB_PREFIX, $query);
                 $query = str_replace("IF EXISTS `", "IF EXISTS `" . DB_PREFIX, $query);
                 $query = str_replace("TABLE `", "TABLE `" . DB_PREFIX, $query);
                 $query = str_replace("INTO `", "INTO `" . DB_PREFIX, $query);
                 $query = str_replace("TABLES `", "TABLES `" . DB_PREFIX, $query);
                 if (!$mysql->query($query)) {
                     if (defined("DEBUG")) {
                         die("MYSQL Error: " . $mysql->error . "<Br><br>in query: <textarea>{$query}</textarea><br>");
                     } else {
                         die("MYSQL Error: " . $mysql->error . "<br>");
                     }
                 }
                 $query = "";
                 $queries++;
             } elseif (substr(trim($line), -1, 1) == ";") {
                 $query = str_replace("NOT EXISTS `", "NOT EXISTS `" . DB_PREFIX, $query);
                 $query = str_replace("IF EXISTS `", "IF EXISTS `" . DB_PREFIX, $query);
                 $query = str_replace("TABLE `", "TABLE `" . DB_PREFIX, $query);
                 $query = str_replace("INTO `", "INTO `" . DB_PREFIX, $query);
                 $query = str_replace("TABLES `", "TABLES `" . DB_PREFIX, $query);
                 if (!$mysql->query($query)) {
                     if (defined("DEBUG")) {
                         die("MYSQL Error: " . $mysql->error . "<Br><br>in query: <textarea>{$query}</textarea><br>");
                     } else {
                         die("MYSQL Error: " . $mysql->error . "<br>");
                     }
                 }
                 $query = "";
                 $queries++;
             }
         }
     }
     if ($queries == 0) {
         die("NO QUERIES RUN<br>");
     }
     return true;
 }
开发者ID:Covert-Inferno,项目名称:eve-jacknife,代码行数:51,代码来源:Installer.php


示例15: peekLine

 public function peekLine()
 {
     $line = false;
     if ($this->tResource !== false) {
         if ($this->tLine === false) {
             $this->tLine = gzgets($this->tResource, FileDecoder::BUFLEN);
         }
         if ($this->tLine !== false) {
             $line = $this->tLine;
         } else {
             bzclose($this->tResource);
             $this->tResource = false;
         }
     }
     return $line;
 }
开发者ID:TheBillPleaseZA,项目名称:phplogmon,代码行数:16,代码来源:FileDecoderBzip2.class.php


示例16: loadStatus

 function loadStatus($path)
 {
     $gz = gzopen($path, "rb");
     while ($line = gzgets($gz)) {
         $a = json_decode($line, true);
         $s = new TwitterStatus($a);
         $this->listStatus[] = $s;
         if ($s->user) {
             $this->listUser[$s->user->screen_name] = $s->user;
         }
         if ($this->lastId < $s->id) {
             $this->lastId = $s->id;
         }
     }
     gzclose($gz);
 }
开发者ID:hidetobara,项目名称:VolatileTwit,代码行数:16,代码来源:twitter.class.php


示例17: _getFileContentsAsArray

 /**
  * Returns the contents of the file as an array, split on PHP_EOL.
  *
  * @param string $file
  * @return array
  */
 protected static function _getFileContentsAsArray($file)
 {
     // Fortunately, gzopen() will handle reading uncompressed files too
     $fileContents = array();
     $fh = gzopen($file, 'r');
     $eolLen = strlen(PHP_EOL);
     while ($line = gzgets($fh)) {
         /* Here I'm not just doing an easy trimming of whitespace because I
            want to be sure that any trailing whitespace that was meant to be
            on this line of the file stays there. */
         if (substr($line, $eolLen * -1) == PHP_EOL) {
             $line = substr($line, 0, strlen($line) - $eolLen);
         }
         $fileContents[] = $line;
     }
     gzclose($fh);
     return $fileContents;
 }
开发者ID:performics,项目名称:ga-cli-api,代码行数:24,代码来源:TempFileTestCase.class.php


示例18: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $now = time();
     $file_csv = $this->getContainer()->getParameter('kernel.cache_dir') . '/' . $this->getContainer()->getParameter('anime_db.ani_db.titles_db');
     if (!file_exists($file_csv) || filemtime($file_csv) + self::CACHE_LIFE_TIME < $now) {
         try {
             $file = $this->getOriginDb($output, $now);
         } catch (\Exception $e) {
             $output->writeln(sprintf('<error>AniDB list titles is not downloaded: %s</error>', $e->getMessage()));
             return 0;
         }
         $output->writeln('Start assembling database');
         // clear list titles and add unified title
         $fp = gzopen($file, 'r');
         $fp_csv = gzopen($file_csv, 'w');
         while (!gzeof($fp)) {
             $line = trim(gzgets($fp, 4096));
             // ignore comments
             if ($line[0] == '#') {
                 continue;
             }
             list($aid, $type, $lang, $title) = explode('|', $line);
             $lang = substr($lang, 0, 2);
             // ignore not supported locales
             if ($lang == 'x-') {
                 continue;
             }
             gzwrite($fp_csv, $aid . '|' . $type . '|' . $lang . '|' . $this->getUnifiedTitle($title) . '|' . $title . "\n");
         }
         gzclose($fp);
         gzclose($fp_csv);
         touch($file, $now);
         touch($file_csv, $now);
         $output->writeln('The titles database is updated');
     } else {
         $output->writeln('Update is not needed');
     }
     return 0;
 }
开发者ID:anime-db,项目名称:ani-db-filler-bundle,代码行数:45,代码来源:UpdateTitlesCommand.php


示例19: analyse_db_file

 public function analyse_db_file($timestamp, $res, $db_file = false, $header_only = false)
 {
     $mess = array();
     $warn = array();
     $err = array();
     $info = array();
     global $wp_version;
     include ABSPATH . WPINC . '/version.php';
     $updraft_dir = $this->backups_dir_location();
     if (false === $db_file) {
         # This attempts to raise the maximum packet size. This can't be done within the session, only globally. Therefore, it has to be done before the session starts; in our case, during the pre-analysis.
         $this->get_max_packet_size();
         $backup = $this->get_backup_history($timestamp);
         if (!isset($backup['nonce']) || !isset($backup['db'])) {
             return array($mess, $warn, $err, $info);
         }
         $db_file = is_string($backup['db']) ? $updraft_dir . '/' . $backup['db'] : $updraft_dir . '/' . $backup['db'][0];
     }
     if (!is_readable($db_file)) {
         return array($mess, $warn, $err, $info);
     }
     // Encrypted - decrypt it
     if ($this->is_db_encrypted($db_file)) {
         $encryption = empty($res['updraft_encryptionphrase']) ? UpdraftPlus_Options::get_updraft_option('updraft_encryptionphrase') : $res['updraft_encryptionphrase'];
         if (!$encryption) {
             if (class_exists('UpdraftPlus_Addon_MoreDatabase')) {
                 $err[] = sprintf(__('Error: %s', 'updraftplus'), __('Decryption failed. The database file is encrypted, but you have no encryption key entered.', 'updraftplus'));
             } else {
                 $err[] = sprintf(__('Error: %s', 'updraftplus'), __('Decryption failed. The database file is encrypted.', 'updraftplus'));
             }
             return array($mess, $warn, $err, $info);
         }
         $ciphertext = $this->decrypt($db_file, $encryption);
         if ($ciphertext) {
             $new_db_file = $updraft_dir . '/' . basename($db_file, '.crypt');
             if (!file_put_contents($new_db_file, $ciphertext)) {
                 $err[] = __('Failed to write out the decrypted database to the filesystem.', 'updraftplus');
                 return array($mess, $warn, $err, $info);
             }
             $db_file = $new_db_file;
         } else {
             $err[] = __('Decryption failed. The most likely cause is that you used the wrong key.', 'updraftplus');
             return array($mess, $warn, $err, $info);
         }
     }
     # Even the empty schema when gzipped comes to 1565 bytes; a blank WP 3.6 install at 5158. But we go low, in case someone wants to share single tables.
     if (filesize($db_file) < 1000) {
         $err[] = sprintf(__('The database is too small to be a valid WordPress database (size: %s Kb).', 'updraftplus'), round(filesize($db_file) / 1024, 1));
         return array($mess, $warn, $err, $info);
     }
     $is_plain = '.gz' == substr($db_file, -3, 3) ? false : true;
     $dbhandle = $is_plain ? fopen($db_file, 'r') : $this->gzopen_for_read($db_file, $warn, $err);
     if (!is_resource($dbhandle)) {
         $err[] = __('Failed to open database file.', 'updraftplus');
         return array($mess, $warn, $err, $info);
     }
     # Analyse the file, print the results.
     $line = 0;
     $old_siteurl = '';
     $old_home = '';
     $old_table_prefix = '';
     $old_siteinfo = array();
     $gathering_siteinfo = true;
     $old_wp_version = '';
     $old_php_version = '';
     $tables_found = array();
     // TODO: If the backup is the right size/checksum, then we could restore the $line <= 100 in the 'while' condition and not bother scanning the whole thing? Or better: sort the core tables to be first so that this usually terminates early
     $wanted_tables = array('terms', 'term_taxonomy', 'term_relationships', 'commentmeta', 'comments', 'links', 'options', 'postmeta', 'posts', 'users', 'usermeta');
     $migration_warning = false;
     // Don't set too high - we want a timely response returned to the browser
     // Until April 2015, this was always 90. But we've seen a few people with ~1Gb databases (uncompressed), and 90s is not enough. Note that we don't bother checking here if it's compressed - having a too-large timeout when unexpected is harmless, as it won't be hit. On very large dbs, they're expecting it to take a while.
     // "120 or 240" is a first attempt at something more useful than just fixed at 90 - but should be sufficient (as 90 was for everyone without ~1Gb databases)
     $default_dbscan_timeout = filesize($db_file) < 31457280 ? 120 : 240;
     $dbscan_timeout = defined('UPDRAFTPLUS_DBSCAN_TIMEOUT') && is_numeric(UPDRAFTPLUS_DBSCAN_TIMEOUT) ? UPDRAFTPLUS_DBSCAN_TIMEOUT : $default_dbscan_timeout;
     @set_time_limit($dbscan_timeout);
     while (($is_plain && !feof($dbhandle) || !$is_plain && !gzeof($dbhandle)) && ($line < 100 || !$header_only && count($wanted_tables) > 0)) {
         $line++;
         // Up to 1Mb
         $buffer = $is_plain ? rtrim(fgets($dbhandle, 1048576)) : rtrim(gzgets($dbhandle, 1048576));
         // Comments are what we are interested in
         if (substr($buffer, 0, 1) == '#') {
             if ('' == $old_siteurl && preg_match('/^\\# Backup of: (http(.*))$/', $buffer, $matches)) {
                 $old_siteurl = untrailingslashit($matches[1]);
                 $mess[] = __('Backup of:', 'updraftplus') . ' ' . htmlspecialchars($old_siteurl) . (!empty($old_wp_version) ? ' ' . sprintf(__('(version: %s)', 'updraftplus'), $old_wp_version) : '');
                 // Check for should-be migration
                 if (!$migration_warning && $old_siteurl != untrailingslashit(site_url())) {
                     $migration_warning = true;
                     $powarn = apply_filters('updraftplus_dbscan_urlchange', sprintf(__('Warning: %s', 'updraftplus'), '<a href="https://updraftplus.com/shop/migrator/">' . __('This backup set is from a different site - this is not a restoration, but a migration. You need the Migrator add-on in order to make this work.', 'updraftplus') . '</a>'), $old_siteurl, $res);
                     if (!empty($powarn)) {
                         $warn[] = $powarn;
                     }
                 }
             } elseif ('' == $old_home && preg_match('/^\\# Home URL: (http(.*))$/', $buffer, $matches)) {
                 $old_home = untrailingslashit($matches[1]);
                 // Check for should-be migration
                 if (!$migration_warning && $old_home != home_url()) {
                     $migration_warning = true;
                     $powarn = apply_filters('updraftplus_dbscan_urlchange', sprintf(__('Warning: %s', 'updraftplus'), '<a href="https://updraftplus.com/shop/migrator/">' . __('This backup set is from a different site - this is not a restoration, but a migration. You need the Migrator add-on in order to make this work.', 'updraftplus') . '</a>'), $old_home, $res);
                     if (!empty($powarn)) {
                         $warn[] = $powarn;
//.........这里部分代码省略.........
开发者ID:santikrass,项目名称:apache,代码行数:101,代码来源:class-updraftplus.php


示例20: restore_backup_db


//.........这里部分代码省略.........
             $this->last_error_no = mysql_errno($this->mysql_dbh);
         }
     }
     if (!$req && ($this->use_wpdb || $this->last_error_no === 1142)) {
         $this->create_forbidden = true;
         # If we can't create, then there's no point dropping
         $this->drop_forbidden = true;
         echo '<strong>' . __('Warning:', 'updraftplus') . '</strong> ';
         $updraftplus->log_e('Your database user does not have permission to create tables. We will attempt to restore by simply emptying the tables; this should work as long as a) you are restoring from a WordPress version with the same database structure, and b) Your imported database does not contain any tables which are not already present on the importing site.', ' (' . $this->last_error . ')');
     } else {
         if ($this->use_wpdb) {
             $req = $wpdb->query("DROP TABLE {$random_table_name}");
             if (!$req) {
                 $this->last_error = $wpdb->last_error;
             }
             $this->last_error_no = false;
         } else {
             $req = mysql_unbuffered_query("DROP TABLE {$random_table_name}", $this->mysql_dbh);
             if (!$req) {
                 $this->last_error = mysql_error($this->mysql_dbh);
                 $this->last_error_no = mysql_errno($this->mysql_dbh);
             }
         }
         if (!$req && ($this->use_wpdb || $this->last_error_no === 1142)) {
             $this->drop_forbidden = true;
             echo '<strong>' . __('Warning:', 'updraftplus') . '</strong> ';
             $updraftplus->log_e('Your database user does not have permission to drop tables. We will attempt to restore by simply emptying the tables; this should work as long as you are restoring from a WordPress version with the same database structure (%s)', ' (' . $this->last_error . ')');
         }
     }
     $restoring_table = '';
     $max_allowed_packet = $updraftplus->get_max_packet_size();
     while (!gzeof($dbhandle)) {
         // Up to 1Mb
         $buffer = rtrim(gzgets($dbhandle, 1048576));
         // Discard comments
         if (empty($buffer) || substr($buffer, 0, 1) == '#') {
             if ('' == $this->old_siteurl && preg_match('/^\\# Backup of: (http(.*))$/', $buffer, $matches)) {
                 $this->old_siteurl = untrailingslashit($matches[1]);
                 $updraftplus->log_e('<strong>Backup of:</strong> %s', htmlspecialchars($this->old_siteurl));
                 do_action('updraftplus_restore_db_record_old_siteurl', $this->old_siteurl);
             } elseif (false === $this->created_by_version && preg_match('/^\\# Created by UpdraftPlus version ([\\d\\.]+)/', $buffer, $matches)) {
                 $this->created_by_version = trim($matches[1]);
                 echo '<strong>' . __('Backup created by:', 'updraftplus') . '</strong> ' . htmlspecialchars($this->created_by_version) . '<br>';
                 $updraftplus->log('Backup created by: ' . $this->created_by_version);
             } elseif ('' == $this->old_home && preg_match('/^\\# Home URL: (http(.*))$/', $buffer, $matches)) {
                 $this->old_home = untrailingslashit($matches[1]);
                 if ($this->old_siteurl && $this->old_home != $this->old_siteurl) {
                     echo '<strong>' . __('Site home:', 'updraftplus') . '</strong> ' . htmlspecialchars($this->old_home) . '<br>';
                     $updraftplus->log('Site home: ' . $this->old_home);
                 }
                 do_action('updraftplus_restore_db_record_old_home', $this->old_home);
             } elseif ('' == $this->old_content && preg_match('/^\\# Content URL: (http(.*))$/', $buffer, $matches)) {
                 $this->old_content = untrailingslashit($matches[1]);
                 echo '<strong>' . __('Content URL:', 'updraftplus') . '</strong> ' . htmlspecialchars($this->old_content) . '<br>';
                 $updraftplus->log('Content URL: ' . $this->old_content);
                 do_action('updraftplus_restore_db_record_old_content', $this->old_content);
             } elseif ('' == $old_table_prefix && preg_match('/^\\# Table prefix: (\\S+)$/', $buffer, $matches)) {
                 $old_table_prefix = $matches[1];
                 echo '<strong>' . __('Old table prefix:', 'updraftplus') . '</strong> ' . htmlspecialchars($old_table_prefix) . '<br>';
                 $updraftplus->log("Old table prefix: " . $old_table_prefix);
             } elseif ($gathering_siteinfo && preg_match('/^\\# Site info: (\\S+)$/', $buffer, $matches)) {
                 if ('end' == $matches[1]) {
                     $gathering_siteinfo = false;
                     // Sanity checks
                     if (isset($old_siteinfo['multisite']) && !$old_siteinfo['multisite'] && is_multisite()) {
                         // Just need to check that you're crazy
开发者ID:jeanpage,项目名称:ca_learn,代码行数:67,代码来源:restorer.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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