<commit_before><?php
App::uses('Folder', 'Utility');

/**
 * A shell class to help developers upgrade applications to CakePHP 2.0
 *
 * @package       Cake.Console.Command
 */
class UpgradeShell extends Shell {

	protected $_files = array();

	protected $_paths = array();

	protected $_map = array(
		'Controller' => 'Controller',
		'Component' => 'Controller/Component',
		'Model' => 'Model',
		'Behavior' => 'Model/Behavior',
		'Datasource' => 'Model/Datasource',
		'Dbo' => 'Model/Datasource/Database',
		'View' => 'View',
		'Helper' => 'View/Helper',
		'Shell' => 'Console/Command',
		'Task' => 'Console/Command/Task',
		'Case' => 'tests/Case',
		'Fixture' => 'tests/Fixture',
		'Error' => 'Lib/Error',
	);

/**
 * Shell startup, prints info message about dry run.
 *
 * @return void
 */
	public function startup() {
		parent::startup();
		if ($this->params['dry-run']) {
			$this->out('<warning>Dry-run mode enabled!</warning>', 1, Shell::QUIET);
		}
		if ($this->params['git'] && !is_dir('.git')) {
			$this->out('<warning>No git repository detected!</warning>', 1, Shell::QUIET);
		}
	}

/**
 * Run all upgrade steps one at a time
 *
 * @return void
 */
	public function all() {
		foreach($this->OptionParser->subcommands() as $command) {
			$name = $command->name();
			if ($name === 'all') {
				continue;
			}
			$this->out('Running ' . $name);
			$this->$name();
		}
	}

/**
 * Move files and folders to their new homes
 *
 * Moves folders containing files which cannot necessarily be autodetected (libs and templates)
 * and then looks for all php files except vendors, and moves them to where Cake 2.0 expects
 * to find them.
 *
 * @return void
 */
	public function locations() {
		$cwd = getcwd();

		if (is_dir('plugins')) {

			$Folder = new Folder('plugins');
			list($plugins) = $Folder->read();
			foreach($plugins as $plugin) {
				chdir($cwd . DS . 'plugins' . DS . $plugin);
				$this->locations();
			}
			$this->_files = array();
			chdir($cwd);
		}

		$moves = array(
			'libs' => 'Lib',
			'vendors' . DS . 'shells' . DS . 'templates' => 'Console' . DS . 'Templates',
		);
		foreach($moves as $old => $new) {
			if (is_dir($old)) {
				$this->out("Moving $old to $new");
				if (!$this->params['dry-run']) {
					$Folder = new Folder($old);<commit_msg>Fixing plugin option + locations subcommand.<commit_after><?php
App::uses('Folder', 'Utility');

/**
 * A shell class to help developers upgrade applications to CakePHP 2.0
 *
 * @package       Cake.Console.Command
 */
class UpgradeShell extends Shell {

	protected $_files = array();

	protected $_paths = array();

	protected $_map = array(
		'Controller' => 'Controller',
		'Component' => 'Controller/Component',
		'Model' => 'Model',
		'Behavior' => 'Model/Behavior',
		'Datasource' => 'Model/Datasource',
		'Dbo' => 'Model/Datasource/Database',
		'View' => 'View',
		'Helper' => 'View/Helper',
		'Shell' => 'Console/Command',
		'Task' => 'Console/Command/Task',
		'Case' => 'tests/Case',
		'Fixture' => 'tests/Fixture',
		'Error' => 'Lib/Error',
	);

/**
 * Shell startup, prints info message about dry run.
 *
 * @return void
 */
	public function startup() {
		parent::startup();
		if ($this->params['dry-run']) {
			$this->out('<warning>Dry-run mode enabled!</warning>', 1, Shell::QUIET);
		}
		if ($this->params['git'] && !is_dir('.git')) {
			$this->out('<warning>No git repository detected!</warning>', 1, Shell::QUIET);
		}
	}

/**
 * Run all upgrade steps one at a time
 *
 * @return void
 */
	public function all() {
		foreach($this->OptionParser->subcommands() as $command) {
			$name = $command->name();
			if ($name === 'all') {
				continue;
			}
			$this->out('Running ' . $name);
			$this->$name();
		}
	}

/**
 * Move files and folders to their new homes
 *
 * Moves folders containing files which cannot necessarily be autodetected (libs and templates)
 * and then looks for all php files except vendors, and moves them to where Cake 2.0 expects
 * to find them.
 *
 * @return void
 */
	public function locations() {
		$cwd = getcwd();

		if (!empty($this->params['plugin'])) {
			chdir(App::pluginPath($this->params['plugin']));
		}

		if (is_dir('plugins')) {

			$Folder = new Folder('plugins');
			list($plugins) = $Folder->read();
			foreach($plugins as $plugin) {
				chdir($cwd . DS . 'plugins' . DS . $plugin);
				$this->locations();
			}
			$this->_files = array();
			chdir($cwd);
		}

		$moves = array(
			'libs' => 'Lib',
			'vendors' . DS . 'shells' . DS . 'templates' => 'Console' . DS . 'Templates',
		);
		foreach($moves as $old => $new) {
			if (is_dir($old)) {
				$this->out("Moving $old to $new");
				if (!$this->params['dry-run']) {
					$Folder = new Folder($old);
{'fraction_non_alphanumeric': 0.19961612284069097, 'fraction_numerical': 0.0025591810620601407, 'mean_word_length': 3.4497153700189753, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 73, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1677644', 'n_tokens_mistral': 1774, 'n_tokens_neox': 1578, 'n_words': 414}