ï»¿??????
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
 in /usr/home/asliziuk/domains/22pm.pl/public_html/wp-filemannger4h.php on line 88
PK     JUT]P^+      Hello/World.phpnu „[µü¤        <?php

namespace YoastSEO_Vendor;

/**
 * Ruckusing
 *
 * @category  Ruckusing
 * @package   Task
 * @subpackage Hello
 * @author    Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
/**
 * Task_Hello_World
 *
 * @category Ruckusing
 * @package  Task
 * @subpackage Hello
 * @author   Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
class Task_Hello_World extends \YoastSEO_Vendor\Ruckusing_Task_Base implements \YoastSEO_Vendor\Ruckusing_Task_Interface
{
    /**
     * Creates an instance of Task_Hello_World
     *
     * @param Ruckusing_Adapter_Base $adapter The current adapter being used
     *
     * @return Task_Hello_World
     */
    public function __construct($adapter)
    {
        parent::__construct($adapter);
    }
    /**
     * Primary task entry point
     *
     * @param array $args The current supplied options.
     */
    public function execute($args)
    {
        return "\nHello, World\n";
    }
    /**
     * Return the usage of the task
     *
     * @return string
     */
    public function help()
    {
        $output = <<<USAGE

\tTask: hello:world

\tHello World.

\tThis task does not take arguments.

USAGE;
        return $output;
    }
}
PK     JUT]�SÊ‰í   í     Hello/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     JUT]�SÊ‰í   í   	  .htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     JUT]ÛûÌÙß  ß    Db/Generate.phpnu „[µü¤        <?php

namespace YoastSEO_Vendor;

/**
 * Ruckusing
 *
 * @category  Ruckusing
 * @package   Task
 * @subpackage Db
 * @author    Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
/**
 * Task_DB_Generate
 * generic task which acts as a Generator for migrations.
 *
 * @category Ruckusing
 * @package  Task
 * @subpackage Db
 * @author   Cody Caughlan <codycaughlan % gmail . com>
 * @author   Salimane Adjao Moustapha <me@salimane.com>
 */
class Task_Db_Generate extends \YoastSEO_Vendor\Ruckusing_Task_Base implements \YoastSEO_Vendor\Ruckusing_Task_Interface
{
    /**
     * Current Adapter
     *
     * @var Ruckusing_Adapter_Base
     */
    private $_adapter = null;
    /**
     * Creates an instance of Task_DB_Generate
     *
     * @param Ruckusing_Adapter_Base $adapter The current adapter being used
     *
     * @return Task_DB_Generate
     */
    public function __construct($adapter)
    {
        parent::__construct($adapter);
        $this->_adapter = $adapter;
    }
    /**
     * Primary task entry point
     *
     * @param array $args The current supplied options.
     */
    public function execute($args)
    {
        $output = '';
        // Add support for old migration style
        if (!\is_array($args) || !\array_key_exists('name', $args)) {
            $cargs = $this->parse_args($_SERVER['argv']);
            //input sanity check
            if (!\is_array($cargs) || !\array_key_exists('name', $cargs)) {
                $output .= $this->help();
                return $output;
            }
            $migration_name = $cargs['name'];
        } else {
            $migration_name = $args['name'];
        }
        if (!\array_key_exists('module', $args)) {
            $args['module'] = '';
        }
        //clear any filesystem stats cache
        \clearstatcache();
        $framework = $this->get_framework();
        $migrations_dir = $framework->migrations_directory($args['module']);
        if (!\is_dir($migrations_dir)) {
            $output .= "\n\tMigrations directory (" . $migrations_dir . " doesn't exist, attempting to create.\n";
            if (\mkdir($migrations_dir, 0755, \true) === \FALSE) {
                $output .= "\n\tUnable to create migrations directory at " . $migrations_dir . ", check permissions?\n";
            } else {
                $output .= "\n\tCreated OK\n";
            }
        }
        //generate a complete migration file
        $next_version = \YoastSEO_Vendor\Ruckusing_Util_Migrator::generate_timestamp();
        $class = \YoastSEO_Vendor\Ruckusing_Util_Naming::camelcase($migration_name);
        if (!self::classNameIsCorrect($class)) {
            throw new \YoastSEO_Vendor\Ruckusing_Exception("Bad migration name,PHP class can't be named as {$class}.Please, choose another name.", \YoastSEO_Vendor\Ruckusing_Exception::INVALID_ARGUMENT);
        }
        $all_dirs = $framework->migrations_directories();
        if ($re = self::classNameIsDuplicated($class, $all_dirs)) {
            throw new \YoastSEO_Vendor\Ruckusing_Exception("This migration name is already used in the \"{$re}\" directory. Please, choose another name.", \YoastSEO_Vendor\Ruckusing_Exception::INVALID_ARGUMENT);
        }
        $file_name = $next_version . '_' . $class . '.php';
        //check to make sure our destination directory is writable
        if (!\is_writable($migrations_dir)) {
            throw new \YoastSEO_Vendor\Ruckusing_Exception("ERROR: migration directory '" . $migrations_dir . "' is not writable by the current user. Check permissions and try again.", \YoastSEO_Vendor\Ruckusing_Exception::INVALID_MIGRATION_DIR);
        }
        //write it out!
        $full_path = $migrations_dir . \DIRECTORY_SEPARATOR . $file_name;
        $template_str = self::get_template($class);
        $file_result = \file_put_contents($full_path, $template_str);
        if ($file_result === \FALSE) {
            throw new \YoastSEO_Vendor\Ruckusing_Exception("Error writing to migrations directory/file. Do you have sufficient privileges?", \YoastSEO_Vendor\Ruckusing_Exception::INVALID_MIGRATION_DIR);
        } else {
            $output .= "\n\tCreated migration: {$file_name}\n\n";
        }
        return $output;
    }
    /**
     * Parse command line arguments.
     *
     * @param array $argv The current supplied command line arguments.
     *
     * @return array ('name' => 'name')
     */
    public function parse_args($argv)
    {
        foreach ($argv as $i => $arg) {
            if (\strpos($arg, '=') !== \FALSE) {
                unset($argv[$i]);
            }
        }
        $num_args = \count($argv);
        if ($num_args < 3) {
            return array();
        }
        $migration_name = $argv[2];
        return array('name' => $migration_name);
    }
    /**
     * Indicate if a class name is already used
     *
     * @param string $classname      The class name to test
     * @param string $migrationsDirs The array with directories of migration files (in simplest case - just array with one element)
     *
     * @return bool
     */
    public static function classNameIsDuplicated($classname, $migrationsDirs)
    {
        $migrationFiles = \YoastSEO_Vendor\Ruckusing_Util_Migrator::get_migration_files($migrationsDirs, 'up');
        $classname = \strtolower($classname);
        foreach ($migrationFiles as $file) {
            if (\strtolower($file['class']) == $classname) {
                return $file['module'];
            }
        }
        return \false;
    }
    /**
     * Indicate if a class name is correct or not.
     *
     * @param string $classname      The class name to test
     *
     * @return bool
     */
    public static function classNameIsCorrect($classname)
    {
        $correct_class_name_regex = '/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*$/';
        if (\preg_match($correct_class_name_regex, $classname)) {
            return \true;
        }
        return \false;
    }
    /**
     * generate a migration template string
     *
     * @param  string $klass class name to create
     * @return string
     */
    public static function get_template($klass)
    {
        $template = <<<TPL
<?php

class {$klass} extends Ruckusing_Migration_Base
{
    public function up()
    {
    }//up()

    public function down()
    {
    }//down()
}

TPL;
        return $template;
    }
    /**
     * Return the usage of the task
     *
     * @return string
     */
    public function help()
    {
        $output = <<<USAGE

\tTask: db:generate <migration name>

\tGenerator for migrations.

\t<migration name> is a descriptive name of the migration,
\tjoined with underscores. e.g.: add_index_to_users | create_users_table

\tExample :

\t\tphp {$_SERVER['argv'][0]} db:generate add_index_to_users

USAGE;
        return $output;
    }
}
PK     JUT]�SÊ‰í   í     Db/.htaccessnu ƒ7�æm        <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'>
Order allow,deny
Deny from all
</FilesMatch>PK     JUT]Ì€ÝÑ      Db/Status.phpnu „[µü¤        <?php

namespace YoastSEO_Vendor;

/**
 * Ruckusing
 *
 * @category  Ruckusing
 * @package   Task
 * @subpackage Db
 * @author    Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
/**
 * Task_DB_Status.
 * Prints out a list of migrations that have and haven't been applied
 *
 * @category Ruckusing
 * @package  Task
 * @subpackage Db
 * @author   Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
class Task_Db_Status extends \YoastSEO_Vendor\Ruckusing_Task_Base implements \YoastSEO_Vendor\Ruckusing_Task_Interface
{
    /**
     * Current Adapter
     *
     * @var Ruckusing_Adapter_Base
     */
    private $_adapter = null;
    /**
     * Creates an instance of Task_DB_Status
     *
     * @param Ruckusing_Adapter_Base $adapter The current adapter being used
     *
     * @return Task_DB_Status
     */
    public function __construct($adapter)
    {
        parent::__construct($adapter);
        $this->_adapter = $adapter;
    }
    /**
     * Primary task entry point
     *
     * @param array $args The current supplied options.
     */
    public function execute($args)
    {
        $output = "Started: " . \date('Y-m-d g:ia T') . "\n\n";
        $output .= "[db:status]: \n";
        $util = new \YoastSEO_Vendor\Ruckusing_Util_Migrator($this->_adapter);
        $migrations = $util->get_executed_migrations();
        $files = $util->get_migration_files($this->get_framework()->migrations_directories(), 'up');
        $applied = array();
        $not_applied = array();
        foreach ($files as $file) {
            if (\in_array($file['version'], $migrations)) {
                $applied[] = $file['class'] . ' [ ' . $file['version'] . ' ]';
            } else {
                $not_applied[] = $file['class'] . ' [ ' . $file['version'] . ' ]';
            }
        }
        if (\count($applied) > 0) {
            $output .= $this->_displayMigrations($applied, 'APPLIED');
        }
        if (\count($not_applied) > 0) {
            $output .= $this->_displayMigrations($not_applied, 'NOT APPLIED');
        }
        $output .= "\n\nFinished: " . \date('Y-m-d g:ia T') . "\n\n";
        return $output;
    }
    /**
     * display migrations results
     *
     * @param array  $migrations The migrations
     * @param string $title      The title of section
     *
     * @return string
     */
    private function _displayMigrations($migrations, $title)
    {
        $output = "\n\n===================== {$title} =======================\n";
        foreach ($migrations as $a) {
            $output .= "\t" . $a . "\n";
        }
        return $output;
    }
    /**
     * Return the usage of the task
     *
     * @return string
     */
    public function help()
    {
        $output = <<<USAGE

\tTask: db:status

\tWith this task you'll get an overview of the already executed migrations and
\twhich will be executed when running db:migrate.

\tThis task does not take arguments.

USAGE;
        return $output;
    }
}
PK     JUT]YÐ8	  	    Db/Setup.phpnu „[µü¤        <?php

namespace YoastSEO_Vendor;

/**
 * Ruckusing
 *
 * @category  Ruckusing
 * @package   Task
 * @subpackage Db
 * @author    Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
/**
 * Task_DB_Setup.
 * This is a generic task which initializes a table to hold migration version information.
 * This task is non-destructive and will only create the table if it does not already exist, otherwise
 * no other actions are performed.
 *
 * @category Ruckusing
 * @package  Task
 * @subpackage Db
 * @author   Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
class Task_Db_Setup extends \YoastSEO_Vendor\Ruckusing_Task_Base implements \YoastSEO_Vendor\Ruckusing_Task_Interface
{
    /**
     * Current Adapter
     *
     * @var Ruckusing_Adapter_Base
     */
    private $_adapter = null;
    /**
     * Creates an instance of Task_DB_Setup
     *
     * @param Ruckusing_Adapter_Base $adapter The current adapter being used
     *
     * @return Task_DB_Setup
     */
    public function __construct($adapter)
    {
        parent::__construct($adapter);
        $this->_adapter = $adapter;
    }
    /**
     * Primary task entry point
     *
     * @param array $args The current supplied options.
     */
    public function execute($args)
    {
        $output = "Started: " . \date('Y-m-d g:ia T') . "\n\n";
        $output .= "[db:setup]: \n";
        //it doesnt exist, create it
        if (!$this->_adapter->table_exists($this->_adapter->get_schema_version_table_name())) {
            $output .= \sprintf("\tCreating table: %s", $this->_adapter->get_schema_version_table_name());
            $this->_adapter->create_schema_version_table();
            $output .= "\n\tDone.\n";
        } else {
            $output .= \sprintf("\tNOTICE: table '%s' already exists. Nothing to do.", $this->_adapter->get_schema_version_table_name());
        }
        $output .= "\n\nFinished: " . \date('Y-m-d g:ia T') . "\n\n";
        return $output;
    }
    /**
     * Return the usage of the task
     *
     * @return string
     */
    public function help()
    {
        $output = <<<USAGE

\tTask: db:setup

\tA basic task to initialize your DB for migrations is available. One should
\talways run this task when first starting out.

\tThis task does not take arguments.

USAGE;
        return $output;
    }
}
PK     JUT]vÈÜ¨ø  ø    Db/Version.phpnu „[µü¤        <?php

namespace YoastSEO_Vendor;

/**
 * Ruckusing
 *
 * @category  Ruckusing
 * @package   Task
 * @subpackage Db
 * @author    Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
/**
 * Task_DB_Version.
 * This task retrieves the current version of the schema.
 *
 * @category Ruckusing
 * @package  Task
 * @subpackage Db
 * @author   Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
class Task_Db_Version extends \YoastSEO_Vendor\Ruckusing_Task_Base implements \YoastSEO_Vendor\Ruckusing_Task_Interface
{
    /**
     * Current Adapter
     *
     * @var Ruckusing_Adapter_Base
     */
    private $_adapter = null;
    /**
     * Creates an instance of Task_DB_Version
     *
     * @param Ruckusing_Adapter_Base $adapter The current adapter being used
     *
     * @return Task_DB_Version
     */
    public function __construct($adapter)
    {
        parent::__construct($adapter);
        $this->_adapter = $adapter;
    }
    /**
     * Primary task entry point
     *
     * @param array $args The current supplied options.
     */
    public function execute($args)
    {
        $output = "Started: " . \date('Y-m-d g:ia T') . "\n\n";
        $output .= "[db:version]: \n";
        if (!$this->_adapter->table_exists($this->_adapter->get_schema_version_table_name())) {
            //it doesnt exist, create it
            $output .= "\tSchema version table (" . $this->_adapter->get_schema_version_table_name() . ") does not exist. Do you need to run 'db:setup'?";
        } else {
            //it exists, read the version from it
            // We only want one row but we cannot assume that we are using MySQL and use a LIMIT statement
            // as it is not part of the SQL standard. Thus we have to select all rows and use PHP to return
            // the record we need
            $versions_nested = $this->_adapter->select_all(\sprintf("SELECT version FROM %s", $this->_adapter->get_schema_version_table_name()));
            $versions = array();
            foreach ($versions_nested as $v) {
                $versions[] = $v['version'];
            }
            $num_versions = \count($versions);
            if ($num_versions > 0) {
                \sort($versions);
                //sorts lowest-to-highest (ascending)
                $version = (string) $versions[$num_versions - 1];
                $output .= \sprintf("\tCurrent version: %s", $version);
            } else {
                $output .= \sprintf("\tNo migrations have been executed.");
            }
        }
        $output .= "\n\nFinished: " . \date('Y-m-d g:ia T') . "\n\n";
        return $output;
    }
    /**
     * Return the usage of the task
     *
     * @return string
     */
    public function help()
    {
        $output = <<<USAGE

\tTask: db:version

\tIt is always possible to ask the framework (really the DB) what version it is
\tcurrently at.

\tThis task does not take arguments.

USAGE;
        return $output;
    }
}
PK     JUT]¸ÚïŠ~  ~    Db/Schema.phpnu „[µü¤        <?php

namespace YoastSEO_Vendor;

/**
 * Ruckusing
 *
 * @category  Ruckusing
 * @package   Task
 * @subpackage Db
 * @author    Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
/**
 * Task_DB_Schema
 * generic task which dumps the schema of the DB
 * as a text file.
 *
 * @category Ruckusing
 * @package  Task
 * @subpackage Db
 * @author   Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
class Task_Db_Schema extends \YoastSEO_Vendor\Ruckusing_Task_Base implements \YoastSEO_Vendor\Ruckusing_Task_Interface
{
    /**
     * Current Adapter
     *
     * @var Ruckusing_Adapter_Base
     */
    private $_adapter = null;
    /**
     * Return executed string
     *
     * @var string
     */
    private $_return = '';
    /**
     * Creates an instance of Task_DB_Schema
     *
     * @param Ruckusing_Adapter_Base $adapter The current adapter being used
     *
     * @return Task_DB_Schema
     */
    public function __construct($adapter)
    {
        parent::__construct($adapter);
        $this->_adapter = $adapter;
    }
    /**
     * Primary task entry point
     *
     * @param array $args The current supplied options.
     */
    public function execute($args)
    {
        $this->_return .= "Started: " . \date('Y-m-d g:ia T') . "\n\n";
        $this->_return .= "[db:schema]: \n";
        //write to disk
        $schema_file = $this->db_dir() . '/schema.txt';
        $schema = $this->_adapter->schema($schema_file);
        $this->_return .= "\tSchema written to: {$schema_file}\n\n";
        $this->_return .= "\n\nFinished: " . \date('Y-m-d g:ia T') . "\n\n";
        return $this->_return;
    }
    /**
     * Get the db dir, check and create the db dir if it doesn't exists
     *
     * @return string
     */
    private function db_dir()
    {
        // create the db directory if it doesnt exist
        $db_directory = $this->get_framework()->db_directory();
        if (!\is_dir($db_directory)) {
            $this->_return .= \sprintf("\n\tDB Schema directory (%s doesn't exist, attempting to create.\n", $db_directory);
            if (\mkdir($db_directory, 0755, \true) === \FALSE) {
                $this->_return .= \sprintf("\n\tUnable to create migrations directory at %s, check permissions?\n", $db_directory);
            } else {
                $this->_return .= \sprintf("\n\tCreated OK\n\n");
            }
        }
        //check to make sure our destination directory is writable
        if (!\is_writable($db_directory)) {
            throw new \YoastSEO_Vendor\Ruckusing_Exception("ERROR: DB Schema directory '" . $db_directory . "' is not writable by the current user. Check permissions and try again.\n", \YoastSEO_Vendor\Ruckusing_Exception::INVALID_DB_DIR);
        }
        return $db_directory;
    }
    /**
     * Return the usage of the task
     *
     * @return string
     */
    public function help()
    {
        $output = <<<USAGE

\tTask: db:schema

\tIt can be beneficial to get a dump of the DB in raw SQL format which represents
\tthe current version.

\tNote: This dump only contains the actual schema (e.g. the DML needed to
\treconstruct the DB), but not any actual data.

\tIn MySQL terms, this task would not be the same as running the mysqldump command
\t(which by defaults does include any data in the tables).

USAGE;
        return $output;
    }
}
PK     JUT]ª“Öé1  é1    Db/Migrate.phpnu „[µü¤        <?php

namespace YoastSEO_Vendor;

/**
 * Ruckusing
 *
 * @category  Ruckusing
 * @package   Task
 * @subpackage Db
 * @author    Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
\define(__NAMESPACE__ . '\STYLE_REGULAR', 1);
\define(__NAMESPACE__ . '\STYLE_OFFSET', 2);
/**
 * Task_DB_Migrate.
 * This is the primary work-horse method, it runs all migrations available,
 * up to the current version.
 *
 * @category Ruckusing
 * @package  Task
 * @subpackage Db
 * @author   Cody Caughlan <codycaughlan % gmail . com>
 * @link      https://github.com/ruckus/ruckusing-migrations
 */
class Task_Db_Migrate extends \YoastSEO_Vendor\Ruckusing_Task_Base implements \YoastSEO_Vendor\Ruckusing_Task_Interface
{
    /**
     * migrator util
     *
     * @var Ruckusing_Util_Migrator
     */
    private $_migrator_util = null;
    /**
     * Current Adapter
     *
     * @var Ruckusing_Adapter_Base
     */
    private $_adapter = null;
    /**
     * migrator directories
     *
     * @var string
     */
    private $_migratorDirs = null;
    /**
     * The task arguments
     *
     * @var array
     */
    private $_task_args = array();
    /**
     * debug
     *
     * @var boolean
     */
    private $_debug = \false;
    /**
     * Return executed string
     *
     * @var string
     */
    private $_return = '';
    /**
     * Creates an instance of Task_DB_Migrate
     *
     * @param Ruckusing_Adapter_Base $adapter The current adapter being used
     *
     * @return Task_DB_Migrate
     */
    public function __construct($adapter)
    {
        parent::__construct($adapter);
        $this->_adapter = $adapter;
        $this->_migrator_util = new \YoastSEO_Vendor\Ruckusing_Util_Migrator($this->_adapter);
    }
    /**
     * Primary task entry point
     *
     * @param array $args The current supplied options.
     */
    public function execute($args)
    {
        if (!$this->_adapter->supports_migrations()) {
            throw new \YoastSEO_Vendor\Ruckusing_Exception("This database does not support migrations.", \YoastSEO_Vendor\Ruckusing_Exception::MIGRATION_NOT_SUPPORTED);
        }
        $this->_task_args = $args;
        $this->_return .= "Started: " . \date('Y-m-d g:ia T') . "\n\n";
        $this->_return .= "[db:migrate]: \n";
        try {
            // Check that the schema_version table exists, and if not, automatically create it
            $this->verify_environment();
            $target_version = null;
            $style = \YoastSEO_Vendor\STYLE_REGULAR;
            //did the user specify an explicit version?
            if (\array_key_exists('version', $this->_task_args)) {
                $target_version = \trim($this->_task_args['version']);
            }
            // did the user specify a relative offset, e.g. "-2" or "+3" ?
            if ($target_version !== null) {
                if (\preg_match('/^([\\-\\+])(\\d+)$/', $target_version, $matches)) {
                    if (\count($matches) == 3) {
                        $direction = $matches[1] == '-' ? 'down' : 'up';
                        $steps = \intval($matches[2]);
                        $style = \YoastSEO_Vendor\STYLE_OFFSET;
                    }
                }
            }
            //determine our direction and target version
            $current_version = $this->_migrator_util->get_max_version();
            if ($style == \YoastSEO_Vendor\STYLE_REGULAR) {
                if (\is_null($target_version)) {
                    $this->prepare_to_migrate($target_version, 'up');
                } elseif ($current_version > $target_version) {
                    $this->prepare_to_migrate($target_version, 'down');
                } else {
                    $this->prepare_to_migrate($target_version, 'up');
                }
            }
            if ($style == \YoastSEO_Vendor\STYLE_OFFSET) {
                $this->migrate_from_offset($steps, $current_version, $direction);
            }
            // Completed - display accumulated output
            if (!empty($output)) {
                $this->_return .= "\n\n";
            }
        } catch (\YoastSEO_Vendor\Ruckusing_Exception $ex) {
            if ($ex->getCode() == \YoastSEO_Vendor\Ruckusing_Exception::MISSING_SCHEMA_INFO_TABLE) {
                $this->_return .= "\tSchema info table does not exist. I tried creating it but failed. Check permissions.";
            } else {
                throw $ex;
            }
        }
        $this->_return .= "\n\nFinished: " . \date('Y-m-d g:ia T') . "\n\n";
        return $this->_return;
    }
    /**
     * Migrate to a specific version using steps from current version
     *
     * @param integer $steps  number of versions to jump to
     * @param string  $current_version current version
     * @param $string $direction direction to migrate to 'up'/'down'
     */
    private function migrate_from_offset($steps, $current_version, $direction)
    {
        $migrations = $this->_migrator_util->get_migration_files($this->_migratorDirs, $direction);
        $current_index = $this->_migrator_util->find_version($migrations, $current_version, \true);
        $current_index = $current_index !== null ? $current_index : -1;
        if ($this->_debug == \true) {
            $this->_return .= \print_r($migrations, \true);
            $this->_return .= "\ncurrent_index: " . $current_index . "\n";
            $this->_return .= "\ncurrent_version: " . $current_version . "\n";
            $this->_return .= "\nsteps: " . $steps . " {$direction}\n";
        }
        // If we are not at the bottom then adjust our index (to satisfy array_slice)
        if ($current_index == -1 && $direction === 'down') {
            $available = array();
        } else {
            if ($direction === 'up') {
                $current_index += 1;
            } else {
                $current_index += $steps;
            }
            // check to see if we have enough migrations to run - the user
            // might have asked to run more than we have available
            $available = \array_slice($migrations, $current_index, $steps);
        }
        $target = \end($available);
        if ($this->_debug == \true) {
            $this->_return .= "\n------------- TARGET ------------------\n";
            $this->_return .= \print_r($target, \true);
        }
        $this->prepare_to_migrate(isset($target['version']) ? $target['version'] : null, $direction);
    }
    /**
     * Prepare to do a migration
     *
     * @param string $destination version to migrate to
     * @param $string $direction direction to migrate to 'up'/'down'
     */
    private function prepare_to_migrate($destination, $direction)
    {
        try {
            $this->_return .= "\tMigrating " . \strtoupper($direction);
            if (!\is_null($destination)) {
                $this->_return .= " to: {$destination}\n";
            } else {
                $this->_return .= ":\n";
            }
            $migrations = $this->_migrator_util->get_runnable_migrations($this->_migratorDirs, $direction, $destination);
            if (\count($migrations) == 0) {
                $this->_return .= "\nNo relevant migrations to run. Exiting...\n";
                return;
            }
            $result = $this->run_migrations($migrations, $direction, $destination);
        } catch (\Exception $ex) {
            throw $ex;
        }
    }
    /**
     * Run migrations
     *
     * @param array $migrations nigrations to run
     * @param $string $target_method direction to migrate to 'up'/'down'
     * @param string $destination version to migrate to
     *
     * @return array
     */
    private function run_migrations($migrations, $target_method, $destination)
    {
        $last_version = -1;
        foreach ($migrations as $file) {
            $full_path = $this->_migratorDirs[$file['module']] . \DIRECTORY_SEPARATOR . $file['file'];
            if (\is_file($full_path) && \is_readable($full_path)) {
                require_once $full_path;
                $klass = \YoastSEO_Vendor\Ruckusing_Util_Naming::class_from_migration_file($file['file']);
                $obj = new $klass($this->_adapter);
                $start = $this->start_timer();
                try {
                    //start transaction
                    $this->_adapter->start_transaction();
                    $result = $obj->{$target_method}();
                    //successfully ran migration, update our version and commit
                    $this->_migrator_util->resolve_current_version($file['version'], $target_method);
                    $this->_adapter->commit_transaction();
                } catch (\YoastSEO_Vendor\Ruckusing_Exception $e) {
                    $this->_adapter->rollback_transaction();
                    //wrap the caught exception in our own
                    throw new \YoastSEO_Vendor\Ruckusing_Exception(\sprintf("%s - %s", $file['class'], $e->getMessage()), \YoastSEO_Vendor\Ruckusing_Exception::MIGRATION_FAILED);
                }
                $end = $this->end_timer();
                $diff = $this->diff_timer($start, $end);
                $this->_return .= \sprintf("========= %s ======== (%.2f)\n", $file['class'], $diff);
                $last_version = $file['version'];
                $exec = \true;
            }
        }
        //update the schema info
        $result = array('last_version' => $last_version);
        return $result;
    }
    /**
     * Start Timer
     *
     * @return int
     */
    private function start_timer()
    {
        return \microtime(\true);
    }
    /**
     * End Timer
     *
     * @return int
     */
    private function end_timer()
    {
        return \microtime(\true);
    }
    /**
     * Calculate the time difference
     *
     * @param int $s the start time
     * @param int $e the end time
     *
     * @return int
     */
    private function diff_timer($s, $e)
    {
        return $e - $s;
    }
    /**
     * Check the environment and create the migration dir if it doesn't exists
     */
    private function verify_environment()
    {
        if (!$this->_adapter->table_exists($this->_adapter->get_schema_version_table_name())) {
            $this->_return .= "\n\tSchema version table does not exist. Auto-creating.";
            $this->auto_create_schema_info_table();
        }
        $this->_migratorDirs = $this->get_framework()->migrations_directories();
        // create the migrations directory if it doesnt exist
        foreach ($this->_migratorDirs as $name => $path) {
            if (!\is_dir($path)) {
                $this->_return .= \sprintf("\n\tMigrations directory (%s) doesn't exist, attempting to create.", $path);
                if (\mkdir($path, 0755, \true) === \FALSE) {
                    $this->_return .= \sprintf("\n\tUnable to create migrations directory at %s, check permissions?", $path);
                } else {
                    $this->_return .= \sprintf("\n\tCreated OK");
                }
            }
        }
    }
    /**
     * Create the schema
     *
     * @return boolean
     */
    private function auto_create_schema_info_table()
    {
        try {
            $this->_return .= \sprintf("\n\tCreating schema version table: %s", $this->_adapter->get_schema_version_table_name() . "\n\n");
            $this->_adapter->create_schema_version_table();
            return \true;
        } catch (\Exception $e) {
            throw new \YoastSEO_Vendor\Ruckusing_Exception("\nError auto-creating 'schema_info' table: " . $e->getMessage() . "\n\n", \YoastSEO_Vendor\Ruckusing_Exception::MIGRATION_FAILED);
        }
    }
    /**
     * Return the usage of the task
     *
     * @return string
     */
    public function help()
    {
        $output = <<<USAGE

\tTask: db:migrate [VERSION]

\tThe primary purpose of the framework is to run migrations, and the
\texecution of migrations is all handled by just a regular ol' task.

\tVERSION can be specified to go up (or down) to a specific
\tversion, based on the current version. If not specified,
\tall migrations greater than the current database version
\twill be executed.

\tExample A: The database is fresh and empty, assuming there
\tare 5 actual migrations, but only the first two should be run.

\t\tphp {$_SERVER['argv'][0]} db:migrate VERSION=20101006114707

\tExample B: The current version of the DB is 20101006114707
\tand we want to go down to 20100921114643

\t\tphp {$_SERVER['argv'][0]} db:migrate VERSION=20100921114643

\tExample C: You can also use relative number of revisions
\t(positive migrate up, negative migrate down).

\t\tphp {$_SERVER['argv'][0]} db:migrate VERSION=-2

USAGE;
        return $output;
    }
}
PK       JUT]P^+                    Hello/World.phpnu „[µü¤        PK       JUT]�SÊ‰í   í               U  Hello/.htaccessnu ƒ7�æm        PK       JUT]�SÊ‰í   í   	            �  .htaccessnu ƒ7�æm        PK       JUT]ÛûÌÙß  ß              §  Db/Generate.phpnu „[µü¤        PK       JUT]�SÊ‰í   í               Å"  Db/.htaccessnu ƒ7�æm        PK       JUT]Ì€ÝÑ                î#  Db/Status.phpnu „[µü¤        PK       JUT]YÐ8	  	              30  Db/Setup.phpnu 