Exemplo n.º 1
0
 /** METHOD: ResetWebConfig
  *  Resetst the IIS web.config file
  */
 public static function ResetWebConfig()
 {
     if (self::isPathNew()) {
         DupUtil::log("WEB.CONFIG CHANGES:");
         @copy('web.config', 'web.config.orig');
         @unlink('web.config');
         DupUtil::log("created backup of original web.config to web.config.orig");
         DupUtil::log("If using IIS web.config this process will need to be done manually.");
     } else {
         DupUtil::log("web.config file was not reset because the old url and new url paths did not change (IIS Only).");
     }
 }
Exemplo n.º 2
0
 /**
  * Take a serialised array and unserialise it replacing elements and
  * unserialising any subordinate arrays and performing the replace.
  * @param string $from       String we're looking to replace.
  * @param string $to         What we want it to be replaced with
  * @param array  $data       Used to pass any subordinate arrays back to in.
  * @param bool   $serialised Does the array passed via $data need serialising.
  * @return array	The original array with all elements replaced as needed. 
  */
 private static function recursive_unserialize_replace($from = '', $to = '', $data = '', $serialised = false)
 {
     // some unseriliased data cannot be re-serialised eg. SimpleXMLElements
     try {
         if (is_string($data) && ($unserialized = @unserialize($data)) !== false) {
             $data = self::recursive_unserialize_replace($from, $to, $unserialized, true);
         } elseif (is_array($data)) {
             $_tmp = array();
             foreach ($data as $key => $value) {
                 $_tmp[$key] = self::recursive_unserialize_replace($from, $to, $value, false);
             }
             $data = $_tmp;
             unset($_tmp);
         } elseif (is_object($data)) {
             $dataClass = get_class($data);
             $_tmp = new $dataClass();
             foreach ($data as $key => $value) {
                 $_tmp->{$key} = self::recursive_unserialize_replace($from, $to, $value, false);
             }
             $data = $_tmp;
             unset($_tmp);
         } else {
             if (is_string($data)) {
                 $data = str_replace($from, $to, $data);
             }
         }
         if ($serialised) {
             return serialize($data);
         }
     } catch (Exception $error) {
         DupUtil::log("\nRECURSIVE UNSERIALIZE ERROR: With string\n" . $data, 2);
     }
     return $data;
 }
        $dbtable_count++;
    }
    @mysqli_free_result($result);
}
if ($dbtable_count == 0) {
    DupUtil::log("NOTICE: You may have to manually run the installer-data.sql to validate data input. Also check to make sure your installer file is correct and the\r\n\t\ttable prefix '{$GLOBALS['FW_TABLEPREFIX']}' is correct for this particular version of WordPress. \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`");
$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);
DupUtil::log("Removed '{$dbdelete_count}' cache/transient rows");
@mysqli_close($dbh);
$profile_end = DupUtil::get_microtime();
DupUtil::log("\nSECTION RUNTIME: " . DupUtil::elapsed_time($profile_end, $profile_start));
$ajax1_end = DupUtil::get_microtime();
$ajax1_sum = DupUtil::elapsed_time($ajax1_end, $ajax1_start);
DupUtil::log("\n{$GLOBALS['SEPERATOR1']}");
DupUtil::log('STEP1 COMPLETE @ ' . @date('h:i:s') . " - TOTAL RUNTIME: {$ajax1_sum}");
DupUtil::log("{$GLOBALS['SEPERATOR1']}");
$JSON['pass'] = 1;
$JSON['table_count'] = $dbtable_count;
$JSON['table_rows'] = $dbquery_rows - ($dbtable_count + $dbdelete_count + $dbquery_errs);
$JSON['query_errs'] = $dbquery_errs;
echo json_encode($JSON);
error_reporting($ajax1_error_level);
die('');