$error_message_help="<p>Have you checked that PHP has write access to the directory that <code>index.php</code> is located in (and all it's contents and subdirectories)? Try <code>sudo chown USERNAME:USERNAME -R path/to/directory</code> and <code>sudo chmod -R 0644 path/to/directory; sudo chmod -R +X path/too/directory</code>, where <code>USERNAME</code> is the username that the PHP process is running under.</p>";
exit(page_renderer::render_minimal("Unpacking error - $settings->sitename","<p>Oops! It looks like $settings->sitename couldn't create the extra data directory to unpack additional files to.</p>$error_message_help"));
}
}
if(!touch($paths->extra_data_directory)){
http_response_code(503);
exit(page_renderer::render_minimal("Unpacking error - $settings->sitename","<p>Oops! It looks like $settings->sitename isn't able to change the last modified time of the extra data directory.</p>$error_message_help"));
exit(page_renderer::render_minimal("Unpacking error - $settings->sitename","<p>Oops! $settings->sitename wasn't able to create a new temporary file with <code>tempnam()</code>. Perhaps your server is mis-configured?</p>"));
exit(page_renderer::render_minimal("Unpacking error - $settings->sitename","<p>Oops! $settings->sitename wasn't able to open itself (i.e. <code>index.php</code>) for reading. $error_message_help</p>"));
exit(page_renderer::render_minimal("Unpacking error - $settings->sitename","<p>Oops! $settings->sitename wasn't able to unpack itself because the ZipArchive doesn't exist or is faulty. Please install the PHP zip extension (on apt-based systems it's the <code>php-zip</code> package) and then try again later. You can check that it's installed by inspecting the output of <code>php -m</code>, or running the <a href='https://www.php.net/manual/en/function.phpinfo.php'><code>phpinfo()</code> command</a>.</p>"));
}
$ex_error=$extractor->open($temp_filename);
if($ex_error!==true){
if($ex_error!==false){
switch($ex_error){
caseZipArchive::ER_EXISTS:
$ex_error="A file already exists";
break;
caseZipArchive::ER_INCONS:
$ex_error="The zip archive was inconsistent";
break;
caseZipArchive::ER_INVAL:
$ex_error="An invalid argument was passed";
break;
caseZipArchive::ER_MEMORY:
$ex_error="A malloc memory error occurred";
break;
caseZipArchive::ER_NOENT:
$ex_error="No such file exists to open";
break;
caseZipArchive::ER_NOZIP:
$ex_error="The file was not a zip archive";
break;
caseZipArchive::ER_READ:
$ex_error="An error occurred when attempting to read the file";
break;
caseZipArchive::ER_SEEK:
$ex_error="An error occurred when seeking while reading the file";
$ex_error="A generic and unidentifiable error occurred (code false)";
}
if(file_exists($paths->extra_data_directory))
delete_recursive($paths->extra_data_directory);
exit(page_renderer::render_minimal("Unpacking error - $settings->sitename","<p>Oops! Unfortunately, $settings->sitename wasn't able to unpack itself properly. This is likely either a server misconfiguration or a bug. ZipArchive, the extractor class used by $settings->sitename says: ${ex_error}.</p>