<?php
/**
* WordPress
*
* @author Installatron Converter
*/
class i_wordpress_4_3_4_upgrade extends i_action_upgrade
{ //==========================================================================
// EXTRACT
//==========================================================================
public function step1_init()
{
$this->setStepLabel("_step_progress_extracting");
}
public function step1_process()
{
$this->extract("main", "upgrtmp");
}
//==========================================================================
// UPGRADE
//==========================================================================
public function step2_init()
{
$this->setStepLabel("_step_progress_processing");
}
public function step2_process()
{
//$this->rm('upgrtmp/wordpress/wp-config.php'); - not included
// don't install plugins they don't want
if (!$this->exists("wp-content/plugins/akismet")) $this->rm("upgrtmp/wordpress/wp-content/plugins/akismet");
if (!$this->exists("wp-content/plugins/hello.php")) $this->rm("upgrtmp/wordpress/wp-content/plugins/hello.php");
$this->mv("upgrtmp/wordpress/*");
$this->rm("upgrtmp");
$this->mkdir(array('wp-content/uploads','wp-content/languages','wp-content/blogs.dir', "wp-content/uploads/et_temp"));
$this->chmod(array("wp-content", "wp-content/uploads", "wp-content/uploads/et_temp", "wp-content/blogs.dir"), 0777);
$this->chmod(array("wp-content/plugins", "wp-content/themes", "wp-content/languages"), 0666, 0777, true);
// fix to remove extra security hardening fail
if ($this->exists("wp-includes/.htaccess"))
{
$r = $this->read("wp-includes/.htaccess");
if ( strpos($r,'<Files ms-files.php>') === false )
{
$this->write("wp-includes/.htaccess", $r."
<Files ms-files.php>
allow from all
</Files>");
}
}
// to avoid safe_mode restrictions:
//@note if anyone is still using PHP <5.4 (when safe_mode is junked) in 2016 I will not be surprised.
if (version_compare($this->env["has_php"], "5.4", "<"))
{
$r = array();
for ( $i = 2013; $i < 2017; ++$i)
{
$r[] = "wp-content/uploads/$i";
for ( $j = 1; $j < 13; ++$j)
{
$r[] = "wp-content/uploads/$i/".sprintf("%02d",$j);
}
}
$this->mkdir($r);
$this->chmod($r, 0777);
}
$this->fetch('wp-admin/upgrade.php?step=1', null, null, false);
// multisite upgrade patch. if multisite not in use, this will just exit.
$this->cp("wp-admin/network/upgrade.php", "wp-admin/network/upgrade.php.bak");
$this->sr("wp-admin/network/upgrade.php",array(
"#require_once\( './admin.php' \);#" => "require( '../../wp-load.php' );set_time_limit(0);",
"#get_current_screen\(\)->add.+'</h2>';#sim" => "",
"#LIMIT ..n., 5#" => ""
));
$this->fetch("wp-admin/network/upgrade.php?action=upgrade", null, null, false);
$this->mv("wp-admin/network/upgrade.php.bak", "wp-admin/network/upgrade.php");
//$this->sr("wp-admin/menu.php", "!(".preg_quote('$submenu[ \'index.php\' ][5] = array( __(\'My Sites\'), \'read\', \'my-sites.php\' );',"!").")!", "$1\n\$submenu[ 'index.php' ][6] = array( __('Manage Sites'), 'read', 'network/index.php' );");
$this->rm(array("readme.html",".maintenance"));
}
}
?>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez