| Server IP : 103.161.17.216 / Your IP : 216.73.216.1 Web Server : nginx/1.18.0 System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/app.houseland.info/application/controllers/admin/ |
Upload File : |
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Auto_update extends AdminController
{
public function index()
{
$purchase_key = trim($this->input->post('purchase_key', false));
$latest_version = $this->input->post('latest_version');
$url = UPDATE_URL . '?purchase_key=' . $purchase_key;
hooks()->do_action('before_perform_update', $latest_version);
$tmp_dir = get_temp_dir();
if (!$tmp_dir || !is_writable($tmp_dir)) {
$tmp_dir = app_temp_dir();
}
try {
$this->checkPermissions();
$config = new app\services\upgrade\Config(
$purchase_key,
$latest_version,
$this->current_db_version,
$url,
$tmp_dir,
FCPATH
);
if ($this->input->post('upgrade_function') === 'old') {
$adapter = new app\services\upgrade\CurlCoreUpgradeAdapter();
} else {
$adapter = new app\services\upgrade\GuzzleCoreUpgradeAdapter();
}
$adapter->setConfig($config);
$upgrade = new app\services\upgrade\UpgradeCore($adapter);
$upgrade->perform();
} catch (Exception $e) {
header('HTTP/1.0 400 Bad error');
echo json_encode([$e->getMessage()]);
}
}
// Temporary function for v1.7.0 will be removed in a future, or perhaps not?
/**
* @throws Exception
*/
private function checkPermissions()
{
$eMessage = 'The application could not write data into <strong>' . FCPATH;
$eMessage .= '</strong> folder. Please give your web server user (<strong>' . get_current_user();
$eMessage .= '</strong>) write permissions in <code>' . FCPATH . '</code> folder:<br/><br/>';
$eMessage .= '<pre style="background: #f0f0f0;padding: 15px;width: 50%; margin-top:0px; border-radius: 4px;">sudo chgrp ' . get_current_user() . ' ';
$eMessage .= FCPATH . '<br/>sudo chmod ug+rwx ' . FCPATH . '</pre>';
$directoryIterator = new RecursiveDirectoryIterator(FCPATH);
foreach (new RecursiveIteratorIterator($directoryIterator) as $file) {
if ($file->isFile() && !$file->isWritable() && strpos($file->getPathName(), '.git') === false) {
throw new Exception($eMessage);
}
}
return true;
}
public function database()
{
}
}