<?php
class i_magento_2_1_9_install extends i_action_install
{
public function step2_init() {}
public function step2_process()
{
// extract the 'main' archive:
$this->extract((($this->input["field_content"] === "yes") ? "demo" : "main"), "upgrtmp");
}
public function step3_init() {}
public function step3_process()
{
// @STATUS:
//
// rowan is adding the new magento versions now
//
// 2.2.0 - just released, not added to this installer yet (too early to add this new major release)
// 2.1.9 - have not been able to get this to upgrade successfully, and this is holding up release of 2.0.16/1.9.3.6
// - rowan is going to contact magento's devs
// - note: doesn't work on cp01; would need MySQL 5.6 to install 2.1.x
// 2.0.16 - added and fully tested on da01
// - note: doesn't work on cp01; would need MySQL 5.6 to install 2.1.x
// 1.9.3.6 - added and fully tested on da01 (might have tested on cp01, can't remember?)
$this->mv('upgrtmp/*');
$this->rm('upgrtmp');
$this->chmod(array('app/etc', 'var', 'vendor', 'pub/media', 'pub/static'), 0666, 0777, true);
// turn off symlinks for images
$this->sr("app/etc/di.xml", "/Symlink/", "Copy");
// fix for old servers
//@ref ticket #11631600
$this->sr(".htaccess",array(
"/RewriteCond ..REQUEST_METHOD. .TRAC\[EK\]\s*RewriteRule .. - \[L,R=405\]/sim" => "",
"/Options \+FollowSymLinks/i" => "Options +SymLinksIfOwnerMatch"
));
// chmod fix - only for non-suexec since Magento's 0770/0660 permissions are fine for suexec
#if ( $this->env["has_php_suexec"] === false ) - IT'S NEEDED ACTUALLY FOR SUPHP.
#{
$this->sr("vendor/magento/framework/Filesystem/DriverInterface.php",array(
"#WRITEABLE_DIRECTORY_MODE = \d+#" => "WRITEABLE_DIRECTORY_MODE = ".( $this->env["has_php_suexec"] !== false ? "0755" : "0777" ),
"#WRITEABLE_FILE_MODE = \d+#" => "WRITEABLE_FILE_MODE = ".( $this->env["has_php_suexec"] !== false ? "0644" : "0666" )
));
/*
// @NOTE: neither of these files exist in 2.1.6
$this->sr(array("lib/internal/Cm/Cache/Backend/File.php","vendor/magento/magento2-base/lib/internal/Cm/Cache/Backend/File.php"),array(
"#'directory_mode' => \d+#" => "'directory_mode' => ".( $this->env["has_php_suexec"] !== false ? "0755" : "0777" ),
"#'file_mode' => \d+#" => "'file_mode' => ".( $this->env["has_php_suexec"] !== false ? "0644" : "0666" )
));
*/
$this->sr("update/cron.php", "#0770#", (($this->env["has_php_suexec"] !== false) ? "0755" : "0777"));
// allow short passwords
$this->sr("vendor/magento/module-user/Model/UserValidationRules.php", "/->addRule\(\s*.passwordChars,\s*'password'\s*\)/sim", "");
// fix litespeed
$this->sr("pub/static/.htaccess", "/php_flag engine 0/", "#php_flag engine 0");
#}
// fix cookie error after installation
$this->sr("vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php", "#MAX_NUM_COOKIES\s*=\s*50#", "MAX_NUM_COOKIES = 200");
$rngadmin = strtolower(i_lib::randstr(8));
$password = "T0".$rngadmin;
//$payload = array(
// 'db' => array(
// 'useExistingDb' => 1,
// 'useAccess' => 1,
// 'host' => $this->db_host,
// 'user' => $this->db_user,
// 'name' => $this->db_name,
// 'password' => $this->db_pass,
// 'tablePrefix' => $this->db_prefix,
// ),
// 'admin' => array(
// 'passwordStatus' => array(
// 'class' => 'strong',
// 'label' => 'Strong',
// ),
// 'username' => "admin",
// 'email' => "devnull@installatron.com",
// 'password' => $password,
// 'confirm' => $password,
// ),
// 'store' => array(
// 'timezone' => 'UTC',
// 'currency' => 'USD',
// 'language' => 'en_US',
// 'useSampleData' => false,
// 'cleanUpDatabase' => false,
// 'loadedAllModules' => true,
// 'showModulesControl' => true,
// 'selectAll' => false,
// ),
// 'config' => array(
// 'encrypt' => array(
// 'type' => 'user',
// 'key' => isset($this->input["field_enckey"]) ? $this->input["field_enckey"] : md5(uniqid(rand(),true)),
// ),
// 'address' => array(
// 'admin' => $rngadmin,
// ),
// ///config.sessionSave.type
// ),
//);
$payload = array(
'admin' => array(
'confirm' => $password,
'email' => "devnull@installatron.com",
'password' => $password,
'passwordStatus' => array(
//'class' => "fair",
//'label' => "Fair",
'class' => 'strong',
'label' => 'Strong',
),
'username' => "admin",
),
'config' => array(
'address' => array(
'actual_base_url' => $this->url,
'admin' => $rngadmin,
'auto_base_url' => $this->url,
'base_url' => $this->url,
),
'advanced' => array(
'expanded' => false,
),
'encrypt' => array(
//'key' => null,
//'type' => "magento",
'type' => 'user',
'key' => isset($this->input["field_enckey"]) ? $this->input["field_enckey"] : md5(uniqid(rand(),true)),
),
'https' => array(
'admin' => false,
'front' => false,
'text' => $this->url,
),
'rewrites' => array(
'allowed' => true,
),
'sessionSave' => array(
'error' => false,
'type' => "files",
),
),
'db' => array(
'host' => $this->db_host,
'name' => $this->db_name,
'password' => $this->db_pass,
'tablePrefix' => $this->db_prefix,
'useAccess' => 1,
'useExistingDb' => 1,
'user' => $this->db_user,
),
'store' => array(
'advanced' => array(
'expanded' => false,
),
'cleanUpDatabase' => false,
'currency' => "USD",
'errorFlag' => false,
'errorMessage' => "",
'force' => false,
'language' => "en_US",
'loadedAllModules' => true,
'selectAll' => true,
'showError' => false,
'showModulesControl' => true,
'timezone' => "UTC",
'useSampleData' => false,
//'allModules' => array(
//'disabledModules' => array(
//'selectedModules' => array(
),
);
$r = $this->fetch("setup/index.php/install/start?".i_lib::json_encode($payload), true);
$this->write(".htinstall.log", $r);
// @NOTE: Rowan's experiments to get Magento locale selection working can be found at this spot in 2.1.7
if ( strpos($r,'"success":true') === false )
{
$this->addError("_errors_script");
return;
}
$this->chmod("var/generation", 0666, 0777, true);
#$this->chmod(array('pub/static'), 0666, 0777, true);
$this->chmod(array('app/etc'), 0644, 0755, true);
//$this->chmod('app/etc', 0755);
// run setup
$this->write("itronsetup.php", '<'.'?php
$_SERVER["argv"] = array("setup:static-content:deploy");
$_SERVER["argc"] = count($_SERVER["argv"]);
try
{
require __DIR__ . "/app/bootstrap.php";
}
catch (\Exception $e)
{
echo "Autoload error: " . $e->getMessage();
exit(1);
}
try
{
$application = new Magento\Framework\Console\Cli("Magento CLI");
$application->run();
}
catch (\Exception $e)
{
while ($e)
{
echo $e->getMessage();
echo $e->getTraceAsString();
$e = $e->getPrevious();
}
exit(1);
}
');
$r = $this->fetch("itronsetup.php", null, null, false);
$this->rm("itronsetup.php");
// run cron
$this->write("itroncron.php", '<'.'?php
$_SERVER["argv"] = array("", "cron:run");
$_SERVER["argc"] = count($_SERVER["argv"]);
try
{
require __DIR__ . "/app/bootstrap.php";
}
catch (\Exception $e)
{
echo "Autoload error: " . $e->getMessage();
exit(1);
}
try
{
$application = new Magento\Framework\Console\Cli("Magento CLI");
$application->run();
}
catch (\Exception $e)
{
while ($e)
{
echo $e->getMessage();
echo $e->getTraceAsString();
$e = $e->getPrevious();
}
exit(1);
}
');
$r = $this->fetch("itroncron.php", null, null, false);
$r = $this->fetch("itroncron.php", null, null, false);//second run, apparently needed
$this->rm("itroncron.php");
$this->chmod('bin/magento', 0744);
}
}
?>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez