/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/migrations/src
NameSizeModeActions
Command/-0755rm
Shell/-0755rm
TestSuite/-0755rm
Util/-0755rm
View/-0755rm
AbstractMigration.php15180644editdlrm
AbstractSeed.php37850644editdlrm
CakeAdapter.php26360644editdlrm
CakeManager.php124470644editdlrm
ConfigurationTrait.php110830644editdlrm
Migrations.php140470644editdlrm
MigrationsDispatcher.php17690644editdlrm
Plugin.php26040644editdlrm
Table.php77300644editdlrm
TableFinderTrait.php61630644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/migrations/src/TableFinderTrait.php (6163B)
false, 'plugin' => null, ]; $tables = $collection->listTables(); if (empty($tables)) { return $tables; } if ($options['require-table'] === true || $options['plugin']) { $tableNamesInModel = $this->getTableNames($options['plugin']); if (empty($tableNamesInModel)) { return []; } foreach ($tableNamesInModel as $num => $table) { if (strpos($table, '.') !== false) { $split = array_reverse(explode('.', $table, 2)); $config = (array)ConnectionManager::getConfig($this->connection); $key = isset($config['schema']) ? 'schema' : 'database'; if ($config[$key] === $split[1]) { $table = $split[0]; } } if (!in_array($table, $tables, true)) { unset($tableNamesInModel[$num]); } } $tables = $tableNamesInModel; } else { foreach ($tables as $num => $table) { if (in_array($table, $this->skipTables, true) || (strpos($table, $this->skipTablesRegex) !== false)) { unset($tables[$num]); continue; } } } return $tables; } /** * Gets list Tables Names * * @param string|null $pluginName Plugin name if exists. * @return string[] */ protected function getTableNames($pluginName = null) { if ($pluginName !== null && !CorePlugin::getCollection()->has($pluginName)) { return []; } $list = []; $tables = $this->findTables($pluginName); if (empty($tables)) { return []; } foreach ($tables as $num => $table) { $list = array_merge($list, $this->fetchTableName($table, $pluginName)); } return array_unique($list); } /** * Find Table Class * * @param string $pluginName Plugin name if exists. * @return array */ protected function findTables($pluginName = null) { $path = 'Model' . DS . 'Table' . DS; if ($pluginName) { $path = CorePlugin::path($pluginName) . 'src' . DS . $path; } else { /** @psalm-suppress UndefinedConstant */ $path = APP . $path; } if (!is_dir($path)) { return []; } $files = (new Filesystem())->find($path, '/\.php$/i', FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::UNIX_PATHS); return array_keys(iterator_to_array($files)); } /** * fetch TableName From Table Object * * @param string $className Name of Table Class. * @param string|null $pluginName Plugin name if exists. * @return string[] */ protected function fetchTableName($className, $pluginName = null) { $tables = []; $className = str_replace('Table.php', '', $className); if (!$className) { return $tables; } if ($pluginName !== null) { $className = $pluginName . '.' . $className; } $namespacedClassName = App::className($className, 'Model/Table', 'Table'); if ($namespacedClassName === null || !class_exists($namespacedClassName)) { return $tables; } $reflection = new ReflectionClass($namespacedClassName); if (!$reflection->isInstantiable()) { return $tables; } $table = TableRegistry::getTableLocator()->get($className); foreach ($table->associations()->keys() as $key) { /** @psalm-suppress PossiblyNullReference */ if ($table->associations()->get($key)->type() === 'belongsToMany') { /** @var \Cake\ORM\Association\BelongsToMany $belongsToMany */ $belongsToMany = $table->associations()->get($key); $tables[] = $belongsToMany->junction()->getTable(); } } $tableName = $table->getTable(); $splitted = array_reverse(explode('.', $tableName, 2)); if (isset($splitted[1])) { $config = ConnectionManager::getConfig($this->connection); if ($config) { $key = isset($config['schema']) ? 'schema' : 'database'; if ($config[$key] === $splitted[1]) { $tableName = $splitted[0]; } } } $tables[] = $tableName; return $tables; } }