MMCT TEAM
Server IP : 192.185.129.71  /  Your IP : 3.128.181.81
Web Server : Apache
System : Linux bh-ht-3.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : svymadmin ( 4072)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home4/svymadmin/public_html/vivekaexcel.edu.in/bkp/application/controllers/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home4/svymadmin/public_html/vivekaexcel.edu.in/bkp/application/controllers/admin/Auto_update.php
<?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()
    {
    }
}

MMCT - 2023