Changeset 2434037
- Timestamp:
- 12/08/2020 11:55:11 AM (5 years ago)
- Location:
- easycontent/trunk
- Files:
-
- 4 added
- 41 edited
-
app/NoticesManager.php (modified) (2 diffs)
-
app/Plugin.php (modified) (4 diffs)
-
app/controllers/actions/main/Connection.php (modified) (3 diffs)
-
app/controllers/actions/main/ImageProcessing.php (modified) (2 diffs)
-
app/controllers/actions/main/Import.php (modified) (2 diffs)
-
app/controllers/actions/main/PublishingOptions.php (modified) (2 diffs)
-
app/controllers/actions/main/Seo.php (modified) (2 diffs)
-
app/db/BaseModel.php (modified) (1 diff)
-
app/db/DbController.php (modified) (2 diffs)
-
app/db/phinx/Application.php (modified) (1 diff)
-
app/db/phinx/console/command/Migrate.php (modified) (2 diffs)
-
app/forms/entities/ApiKeys.php (modified) (2 diffs)
-
app/forms/entities/ImportEntity.php (modified) (2 diffs)
-
app/forms/handlers/RefreshAllDataFormHandler.php (modified) (2 diffs)
-
app/notices (added)
-
app/notices/AdminNotice.php (added)
-
app/notices/AdminNoticeInterface.php (added)
-
app/notices/AdminNoticesService.php (added)
-
easycontent-wp.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_classmap.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (5 diffs)
-
vendor/composer/autoload_static.php (modified) (3 diffs)
-
vendor/composer/installed.json (modified) (2 diffs)
-
vendor/robmorgan/phinx/README.md (modified) (1 diff)
-
vendor/robmorgan/phinx/UPGRADE_0.8.md (modified) (1 diff)
-
vendor/robmorgan/phinx/composer.json (modified) (2 diffs)
-
vendor/robmorgan/phinx/docs/en/commands.rst (modified) (3 diffs)
-
vendor/robmorgan/phinx/docs/en/configuration.rst (modified) (1 diff)
-
vendor/robmorgan/phinx/docs/fr/configuration.rst (modified) (1 diff)
-
vendor/robmorgan/phinx/docs/ja/configuration.rst (modified) (1 diff)
-
vendor/robmorgan/phinx/src/Phinx/Config/Config.php (modified) (5 diffs)
-
vendor/robmorgan/phinx/src/Phinx/Console/Command/AbstractCommand.php (modified) (2 diffs)
-
vendor/robmorgan/phinx/src/Phinx/Console/Command/Init.php (modified) (4 diffs)
-
vendor/robmorgan/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php (modified) (1 diff)
-
vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php (modified) (4 diffs)
-
vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PostgresAdapter.php (modified) (1 diff)
-
vendor/robmorgan/phinx/src/Phinx/Db/Adapter/SqlServerAdapter.php (modified) (1 diff)
-
vendor/robmorgan/phinx/src/Phinx/Migration/Manager/Environment.php (modified) (1 diff)
-
vendor/robmorgan/phinx/src/Phinx/Migration/Migration.template.php.dist (modified) (1 diff)
-
vendor/robmorgan/phinx/src/Phinx/Migration/MigrationInterface.php (modified) (1 diff)
-
vendor/robmorgan/phinx/src/Phinx/Seed/Seed.template.php.dist (modified) (1 diff)
-
vendor/robmorgan/phinx/src/Phinx/Wrapper/TextWrapper.php (modified) (2 diffs)
-
views/admin/pages/connection.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easycontent/trunk/app/NoticesManager.php
r2194825 r2434037 5 5 final class NoticesManager 6 6 { 7 private $notices = ['success' => [], 'error' => [], 'info' => [], 'warning' => []]; 7 const TYPE_SUCCESS = 'success'; 8 const TYPE_ERROR = 'error'; 9 const TYPE_INFO = 'info'; 10 const TYPE_WARNING = 'warning'; 8 11 12 private $notices = [ 13 self::TYPE_SUCCESS => [], 14 self::TYPE_ERROR => [], 15 self::TYPE_INFO => [], 16 self::TYPE_WARNING => [] 17 ]; 9 18 10 p ublicfunction noticeTypeExists($type)19 private function noticeTypeExists($type) 11 20 { 12 21 return ! ( ! $type || ! is_string( $type ) || ! array_key_exists( $type, $this->notices ) ); 13 22 } 14 23 15 16 public function addNotice($notice, $type = 'success') 24 public function addNotice($notice, $type = self::TYPE_SUCCESS) 17 25 { 18 26 if ( ! is_string( $notice ) ) { … … 26 34 $this->notices[$type][] = $notice; 27 35 } 28 29 36 30 37 public function renderNotices() -
easycontent/trunk/app/Plugin.php
r2355111 r2434037 7 7 use EasyContent\WordPress\Db\DbController; 8 8 use EasyContent\WordPress\Metaboxes\MetaBoxesManager; 9 use EasyContent\WordPress\Notices\AdminNotice; 10 use EasyContent\WordPress\Notices\AdminNoticeInterface; 11 use EasyContent\WordPress\Notices\AdminNoticesService; 9 12 use EasyContent\WordPress\Pages\PagesManager; 10 13 use EasyContent\WordPress\Rest\Actions\GetArticleDetails; … … 48 51 private $logger; 49 52 53 /** @var AdminNoticesService $adminNoticesService */ 54 private $adminNoticesService; 55 50 56 51 57 public function init() … … 54 60 return; 55 61 } 62 63 $this->adminNoticesService = new AdminNoticesService(); 64 $this->checkDatabaseIntegrity(); 56 65 57 66 $this->noticesManager = new NoticesManager(); … … 291 300 return "{$scheme}://{$host}"; 292 301 } 302 303 public function getAdminNoticesService() 304 { 305 // Initialized in init() method 306 return $this->adminNoticesService; 307 } 308 309 private function checkDatabaseIntegrity() 310 { 311 if ( $this->getDatabaseController()->checkIntegrity() ) { 312 return; 313 } 314 315 add_action( 'init', function() { 316 $easyContentAction = 'rerun-database-setup'; 317 $wpNonceAction = 'easycontent-rerun-database-setup'; 318 319 $action = isset( $_GET['easycontent-action'] ) 320 ? (string)$_GET['easycontent-action'] 321 : ''; 322 323 if ( $easyContentAction === $action && check_admin_referer( $wpNonceAction ) ) { 324 $this->getDatabaseController()->clearDatabase(); 325 $this->getDatabaseController()->migrate(); 326 327 wp_redirect( admin_url() ); 328 exit; 329 } 330 331 332 333 $errorMessage = array_reduce( $this->getDatabaseController()->getIntegrityErrors(), function($carry, $item) { 334 return $carry . ( $carry ? '<br>' : '' ) 335 . '<strong>EasyContent:</strong> ' 336 . esc_html( $item ) . '!'; 337 }, '' ); 338 339 $url = admin_url() . '?' . http_build_query( [ 340 '_wpnonce' => wp_create_nonce( $wpNonceAction ), 341 'easycontent-action' => $easyContentAction 342 ], '', '&', PHP_QUERY_RFC3986 ); 343 344 $errorMessage .= '<br>You can try to <a href="' . $url . '">rerun</a> database setup.'; 345 $errorMessage .= "<br><strong>WARNING!</strong> This action will erase all plugin's data from database!"; 346 347 $this->getAdminNoticesService()->addAdminNotice( new AdminNotice( $errorMessage, AdminNoticeInterface::TYPE_ERROR ) ); 348 } ); 349 } 293 350 } -
easycontent/trunk/app/controllers/actions/main/Connection.php
r2327436 r2434037 7 7 use EasyContent\WordPress\Forms\Entities\ApiKeys; 8 8 use EasyContent\WordPress\Forms\Entities\ServerConnectionResponse; 9 use EasyContent\WordPress\NoticesManager; 9 10 use EasyContent\WordPress\Plugin; 10 11 use EasyContent\WordPress\View; … … 23 24 $form = $formBuilder 24 25 ->add( 'public', TextType::class ) 25 ->add( 'url', UrlType::class )26 26 ->getForm(); 27 27 … … 40 40 $plugin->noticesManager->addNotice( $successMessage ); 41 41 } catch ( \Exception $e ) { 42 $plugin->noticesManager->addNotice( $e->getMessage(), 'error');42 $plugin->noticesManager->addNotice( $e->getMessage(), NoticesManager::TYPE_ERROR ); 43 43 } 44 44 } elseif ( count( $form->getErrors() ) > 0 ) { 45 45 foreach ( $form->getErrors() as $error ) { 46 $plugin->noticesManager->addNotice( $error->getMessage(), 'error');46 $plugin->noticesManager->addNotice( $error->getMessage(), NoticesManager::TYPE_ERROR ); 47 47 } 48 48 } -
easycontent/trunk/app/controllers/actions/main/ImageProcessing.php
r2189682 r2434037 5 5 use EasyContent\WordPress\Controllers\Actions\BaseAction; 6 6 use EasyContent\WordPress\Forms\Entities\ImageProcessingSettings; 7 use EasyContent\WordPress\NoticesManager; 7 8 use EasyContent\WordPress\Plugin; 8 9 use Symfony\Component\Form\Extension\Core\Type\CheckboxType; … … 32 33 } elseif ( count( $form->getErrors() ) > 0 ) { 33 34 foreach ( $form->getErrors() as $error ) { 34 $plugin->noticesManager->addNotice( $error->getMessage(), 'error');35 $plugin->noticesManager->addNotice( $error->getMessage(), NoticesManager::TYPE_ERROR ); 35 36 } 36 37 } -
easycontent/trunk/app/controllers/actions/main/Import.php
r2194825 r2434037 10 10 use EasyContent\WordPress\Forms\Handlers\RefreshAllDataFormHandler; 11 11 use EasyContent\WordPress\Forms\Types\ArticlesFilterType; 12 use EasyContent\WordPress\NoticesManager; 12 13 use EasyContent\WordPress\Pages\Import\ArticlesListTable; 13 14 use EasyContent\WordPress\Plugin; … … 58 59 } elseif ( count( $importForm->getErrors() ) > 0 ) { 59 60 foreach ( $importForm->getErrors() as $error ) { 60 $plugin->noticesManager->addNotice( $error->getMessage(), 'error');61 $plugin->noticesManager->addNotice( $error->getMessage(), NoticesManager::TYPE_ERROR ); 61 62 } 62 63 } -
easycontent/trunk/app/controllers/actions/main/PublishingOptions.php
r2189682 r2434037 8 8 use EasyContent\WordPress\Forms\Handlers\RefreshAllDataFormHandler; 9 9 use EasyContent\WordPress\Helpers\PublishingOptionsPageHelper; 10 use EasyContent\WordPress\NoticesManager; 10 11 use EasyContent\WordPress\Plugin; 11 12 use Symfony\Component\Form\Extension\Core\Type\CollectionType; … … 44 45 } elseif ( count( $form->getErrors() ) > 0 ) { 45 46 foreach ( $form->getErrors() as $error ) { 46 $plugin->noticesManager->addNotice( $error->getMessage(), 'error');47 $plugin->noticesManager->addNotice( $error->getMessage(), NoticesManager::TYPE_ERROR ); 47 48 } 48 49 } -
easycontent/trunk/app/controllers/actions/main/Seo.php
r2189682 r2434037 5 5 use EasyContent\WordPress\Controllers\Actions\BaseAction; 6 6 use EasyContent\WordPress\Forms\Entities\SeoPlugin; 7 use EasyContent\WordPress\NoticesManager; 7 8 use EasyContent\WordPress\Plugin; 8 9 use Symfony\Component\Form\Extension\Core\Type\ChoiceType; … … 49 50 } elseif ( count( $form->getErrors() ) > 0 ) { 50 51 foreach ( $form->getErrors() as $error ) { 51 $plugin->noticesManager->addNotice( $error->getMessage(), 'error');52 $plugin->noticesManager->addNotice( $error->getMessage(), NoticesManager::TYPE_ERROR ); 52 53 } 53 54 } -
easycontent/trunk/app/db/BaseModel.php
r2355111 r2434037 39 39 } 40 40 41 public static function tableExists() 42 { 43 $wpdb = static::getWpdb(); 44 $tableName = static::tableName(); 45 $query = "SELECT * FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = '{$wpdb->dbname}' AND `TABLE_NAME` = '{$tableName}' LIMIT 1"; 46 return (bool)$wpdb->get_row( $query ); 47 } 41 48 42 49 public static function all() -
easycontent/trunk/app/db/DbController.php
r2327436 r2434037 18 18 /** @var Plugin $plugin */ 19 19 private $plugin; 20 21 private $integrityErrors = []; 20 22 21 23 … … 159 161 delete_option( 'ec-public-api-key' ); 160 162 } 163 164 public function getIntegrityErrors() 165 { 166 return $this->integrityErrors; 167 } 168 169 public function checkIntegrity() 170 { 171 $this->integrityErrors = []; 172 173 $tables = [ 174 Article::class, 175 ArticlePost::class, 176 Category::class, 177 WorkflowStage::class 178 ]; 179 180 global $wpdb; 181 182 foreach ( $tables as $tableClass ) { 183 if ( ! call_user_func( [$tableClass, 'tableExists'] ) ) { 184 $tableName = call_user_func( [$tableClass, 'tableName'] ); 185 $format = __( '`%s`.`%s` table is missing', EASYCONTENT_TXTDOMAIN ); 186 $this->integrityErrors[] = sprintf( $format, $wpdb->dbname, $tableName ); 187 } 188 } 189 190 return ! $this->integrityErrors; 191 } 161 192 } -
easycontent/trunk/app/db/phinx/Application.php
r2189682 r2434037 15 15 16 16 if ($version === null) { 17 $version = '0.1 0.7';17 $version = '0.11.7'; 18 18 } 19 19 -
easycontent/trunk/app/db/phinx/console/command/Migrate.php
r2189682 r2434037 25 25 $migrationTableName = "{$wpdb->prefix}easycontent_migration"; 26 26 27 $hostData = $wpdb->parse_db_host( $wpdb->dbhost ); 28 29 $host = isset( $hostData[0] ) ? $hostData[0] : 'localhost'; 30 $port = isset( $hostData[1] ) ? $hostData[1] : 3306; 31 27 32 $this->setConfig( new Config( [ 28 'paths' => [33 'paths' => [ 29 34 'migrations' => $migrationsPath 30 35 ], … … 34 39 'production' => [ 35 40 'adapter' => 'mysql', 36 'host' => defined( 'DB_HOST' ) ? DB_HOST : 'localhost', 37 'name' => DB_NAME, 38 'user' => defined( 'DB_USER' ) ? DB_USER : 'root', 39 'pass' => defined( 'DB_PASSWORD' ) ? DB_PASSWORD : '', 40 'port' => defined( 'DB_PORT' ) ? DB_PORT : 3306, 41 'charset' => defined( 'DB_CHARSET' ) ? DB_CHARSET : 'utf8' 41 'host' => $host, 42 'name' => $wpdb->dbname, 43 'user' => $wpdb->dbuser, 44 'pass' => $wpdb->dbpassword, 45 'port' => $port, 46 'charset' => $wpdb->charset, 47 'collation' => $wpdb->collate, 42 48 ] 43 49 ] -
easycontent/trunk/app/forms/entities/ApiKeys.php
r2327436 r2434037 20 20 protected $public; 21 21 22 /**23 * @Assert\NotNull24 * @Assert\Type(type = "string")25 * @Assert\Url26 */27 protected $url;28 29 30 22 public function __construct() 31 23 { 32 24 try { 33 25 $settings = Plugin::getInstance()->getSettings(); 34 35 26 $this->setPublic( $settings->publicKey ); 36 $this->setUrl( Plugin::getInstance()->getRefererString() );37 27 } catch ( \Exception $e ) { } 38 28 } 39 40 29 41 30 public function getPublic() … … 48 37 $this->public = $key; 49 38 } 50 51 52 public function getUrl()53 {54 return $this->url;55 }56 57 public function setUrl($url)58 {59 $this->url = $url;60 }61 39 } -
easycontent/trunk/app/forms/entities/ImportEntity.php
r2189682 r2434037 4 4 5 5 use EasyContent\WordPress\Db\Models\WorkflowStage; 6 use EasyContent\WordPress\NoticesManager; 6 7 use EasyContent\WordPress\Pages\Import\Importer; 7 8 use EasyContent\WordPress\Plugin; … … 53 54 $newWorkflowStage = WorkflowStage::findByKey( $this->getNewStage() ); 54 55 } catch ( \Exception $e ) { 55 Plugin::getInstance()->noticesManager->addNotice( 'Unable to find workflow stage', 'error');56 Plugin::getInstance()->noticesManager->addNotice( 'Unable to find workflow stage', NoticesManager::TYPE_ERROR ); 56 57 return false; 57 58 } -
easycontent/trunk/app/forms/handlers/RefreshAllDataFormHandler.php
r2285656 r2434037 9 9 use EasyContent\WordPress\Db\Models\Category as CategoryDbModel; 10 10 use EasyContent\WordPress\Db\Models\WorkflowStage as StageDbModel; 11 use EasyContent\WordPress\NoticesManager; 11 12 use EasyContent\WordPress\Plugin; 12 13 … … 42 43 StageDbModel::setDatabaseCache( $freshStages ); 43 44 } catch ( \Exception $e ) { 44 $nm->addNotice( $e->getMessage(), 'error');45 $nm->addNotice( $e->getMessage(), NoticesManager::TYPE_ERROR ); 45 46 return; 46 47 } -
easycontent/trunk/easycontent-wp.php
r2355111 r2434037 4 4 * Plugin URI: https://easycontent.io 5 5 * Description: Imports articles from EasyContent to your wordpress site and exports articles from your wordpress site to EasyContent 6 * Version: 1.0. 66 * Version: 1.0.7 7 7 * Requires at least: 5.0.7 8 8 * Requires PHP: 5.6 … … 21 21 22 22 if ( ! defined( 'EASYCONTENT_PLUGIN_VERSION' ) ) { 23 define( 'EASYCONTENT_PLUGIN_VERSION', '1.0. 6' );23 define( 'EASYCONTENT_PLUGIN_VERSION', '1.0.7' ); 24 24 } 25 25 -
easycontent/trunk/readme.txt
r2355111 r2434037 6 6 Tested up to: 5.5 7 7 Requires PHP: 5.6 8 Stable tag: 1.0. 68 Stable tag: 1.0.7 9 9 License: GPL-2.0+ 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 61 61 == Changelog == 62 62 63 = 1.0.7 = 64 * Increased database code stability 65 * Added tool that will help to fix database schema if something went wrong 66 63 67 = 1.0.6 = 64 68 * Added ability to push drafted post to EasyContent.io -
easycontent/trunk/vendor/autoload.php
r2355111 r2434037 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 54aed42cfa417ec4213926972db643ad::getLoader();7 return ComposerAutoloaderInit2c67146a226c493fc98bf800e38cef4c::getLoader(); -
easycontent/trunk/vendor/composer/autoload_classmap.php
r2285656 r2434037 279 279 'EasyContent\\WordPress\\Metaboxes\\PostSyncMetaBox' => $baseDir . '/app/metaboxes/PostSyncMetaBox.php', 280 280 'EasyContent\\WordPress\\NoticesManager' => $baseDir . '/app/NoticesManager.php', 281 'EasyContent\\WordPress\\Notices\\AdminNotice' => $baseDir . '/app/notices/AdminNotice.php', 282 'EasyContent\\WordPress\\Notices\\AdminNoticeInterface' => $baseDir . '/app/notices/AdminNoticeInterface.php', 283 'EasyContent\\WordPress\\Notices\\AdminNoticesService' => $baseDir . '/app/notices/AdminNoticesService.php', 281 284 'EasyContent\\WordPress\\Pages\\Import\\ArticlesListTable' => $baseDir . '/app/pages/import/ArticlesListTable.php', 282 285 'EasyContent\\WordPress\\Pages\\Import\\Importer' => $baseDir . '/app/pages/import/Importer.php', -
easycontent/trunk/vendor/composer/autoload_real.php
r2355111 r2434037 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 54aed42cfa417ec4213926972db643ad5 class ComposerAutoloaderInit2c67146a226c493fc98bf800e38cef4c 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit 54aed42cfa417ec4213926972db643ad', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInit2c67146a226c493fc98bf800e38cef4c', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 27 spl_autoload_unregister(array('ComposerAutoloaderInit 54aed42cfa417ec4213926972db643ad', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInit2c67146a226c493fc98bf800e38cef4c', 'loadClassLoader')); 28 28 29 29 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 31 31 require_once __DIR__ . '/autoload_static.php'; 32 32 33 call_user_func(\Composer\Autoload\ComposerStaticInit 54aed42cfa417ec4213926972db643ad::getInitializer($loader));33 call_user_func(\Composer\Autoload\ComposerStaticInit2c67146a226c493fc98bf800e38cef4c::getInitializer($loader)); 34 34 } else { 35 35 $map = require __DIR__ . '/autoload_namespaces.php'; … … 52 52 53 53 if ($useStaticLoader) { 54 $includeFiles = Composer\Autoload\ComposerStaticInit 54aed42cfa417ec4213926972db643ad::$files;54 $includeFiles = Composer\Autoload\ComposerStaticInit2c67146a226c493fc98bf800e38cef4c::$files; 55 55 } else { 56 56 $includeFiles = require __DIR__ . '/autoload_files.php'; 57 57 } 58 58 foreach ($includeFiles as $fileIdentifier => $file) { 59 composerRequire 54aed42cfa417ec4213926972db643ad($fileIdentifier, $file);59 composerRequire2c67146a226c493fc98bf800e38cef4c($fileIdentifier, $file); 60 60 } 61 61 … … 64 64 } 65 65 66 function composerRequire 54aed42cfa417ec4213926972db643ad($fileIdentifier, $file)66 function composerRequire2c67146a226c493fc98bf800e38cef4c($fileIdentifier, $file) 67 67 { 68 68 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
easycontent/trunk/vendor/composer/autoload_static.php
r2355111 r2434037 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 54aed42cfa417ec4213926972db643ad7 class ComposerStaticInit2c67146a226c493fc98bf800e38cef4c 8 8 { 9 9 public static $files = array ( … … 502 502 'EasyContent\\WordPress\\Metaboxes\\PostSyncMetaBox' => __DIR__ . '/../..' . '/app/metaboxes/PostSyncMetaBox.php', 503 503 'EasyContent\\WordPress\\NoticesManager' => __DIR__ . '/../..' . '/app/NoticesManager.php', 504 'EasyContent\\WordPress\\Notices\\AdminNotice' => __DIR__ . '/../..' . '/app/notices/AdminNotice.php', 505 'EasyContent\\WordPress\\Notices\\AdminNoticeInterface' => __DIR__ . '/../..' . '/app/notices/AdminNoticeInterface.php', 506 'EasyContent\\WordPress\\Notices\\AdminNoticesService' => __DIR__ . '/../..' . '/app/notices/AdminNoticesService.php', 504 507 'EasyContent\\WordPress\\Pages\\Import\\ArticlesListTable' => __DIR__ . '/../..' . '/app/pages/import/ArticlesListTable.php', 505 508 'EasyContent\\WordPress\\Pages\\Import\\Importer' => __DIR__ . '/../..' . '/app/pages/import/Importer.php', … … 1618 1621 { 1619 1622 return \Closure::bind(function () use ($loader) { 1620 $loader->prefixLengthsPsr4 = ComposerStaticInit 54aed42cfa417ec4213926972db643ad::$prefixLengthsPsr4;1621 $loader->prefixDirsPsr4 = ComposerStaticInit 54aed42cfa417ec4213926972db643ad::$prefixDirsPsr4;1622 $loader->classMap = ComposerStaticInit 54aed42cfa417ec4213926972db643ad::$classMap;1623 $loader->prefixLengthsPsr4 = ComposerStaticInit2c67146a226c493fc98bf800e38cef4c::$prefixLengthsPsr4; 1624 $loader->prefixDirsPsr4 = ComposerStaticInit2c67146a226c493fc98bf800e38cef4c::$prefixDirsPsr4; 1625 $loader->classMap = ComposerStaticInit2c67146a226c493fc98bf800e38cef4c::$classMap; 1623 1626 1624 1627 }, null, ClassLoader::class); -
easycontent/trunk/vendor/composer/installed.json
r2285656 r2434037 1046 1046 { 1047 1047 "name": "robmorgan/phinx", 1048 "version": "0.11. 4",1049 "version_normalized": "0.11. 4.0",1048 "version": "0.11.7", 1049 "version_normalized": "0.11.7.0", 1050 1050 "source": { 1051 1051 "type": "git", 1052 1052 "url": "https://github.com/cakephp/phinx.git", 1053 "reference": " 10e8c3f6b09111f4c0ef128d5a43375e15286cc5"1054 }, 1055 "dist": { 1056 "type": "zip", 1057 "url": "https://api.github.com/repos/cakephp/phinx/zipball/ 10e8c3f6b09111f4c0ef128d5a43375e15286cc5",1058 "reference": " 10e8c3f6b09111f4c0ef128d5a43375e15286cc5",1053 "reference": "3cdde73e0c33c410e076108b3e1603fabb5b330d" 1054 }, 1055 "dist": { 1056 "type": "zip", 1057 "url": "https://api.github.com/repos/cakephp/phinx/zipball/3cdde73e0c33c410e076108b3e1603fabb5b330d", 1058 "reference": "3cdde73e0c33c410e076108b3e1603fabb5b330d", 1059 1059 "shasum": "" 1060 1060 }, … … 1069 1069 "require-dev": { 1070 1070 "cakephp/cakephp-codesniffer": "^3.0", 1071 "ext-json": "*", 1071 1072 "phpunit/phpunit": ">=5.7,<8.0", 1072 1073 "sebastian/comparator": ">=1.2.3" 1073 1074 }, 1074 "time": "2019-12-24T23:43:31+00:00", 1075 "suggest": { 1076 "ext-json": "Install if using JSON configuration format", 1077 "symfony/yaml": "Install if using YAML configuration format" 1078 }, 1079 "time": "2020-05-09T13:59:05+00:00", 1075 1080 "bin": [ 1076 1081 "bin/phinx" -
easycontent/trunk/vendor/robmorgan/phinx/README.md
r2285656 r2434037 103 103 ## Documentation 104 104 105 Check out http ://docs.phinx.org/en/latest/for the comprehensive documentation.105 Check out https://book.cakephp.org/phinx for the comprehensive documentation. 106 106 107 107 Other translations include: -
easycontent/trunk/vendor/robmorgan/phinx/UPGRADE_0.8.md
r2189682 r2434037 14 14 within a codebase and are merged in to master for deployment. It will no longer matter when the migrations 15 15 were created if it becomes necessary to rollback the migrations. 16 17 * Using an older version of Phinx on a pre 5.6 MySQL installation could lead to a case of an invalid table definition 18 for the `default_migration_table` (e.g. `phinxlog`) when the database was upgraded to 5.6. On upgrading, if you used 19 phinx on a pre 5.6 MySQL installation, it is suggested to do the following: 20 21 ``` 22 ALTER TABLE phinxlog MODIFY start_time timestamp NULL DEFAULT NULL; 23 ALTER TABLE phinxlog MODIFY end_time timestamp NULL DEFAULT NULL; 24 UPDATE phinxlog SET start_time = NULL WHERE start_time = '0000-00-00 00:00:00'; 25 UPDATE phinxlog SET end_time = NULL WHERE end_time = '0000-00-00 00:00:00'; 26 ``` -
easycontent/trunk/vendor/robmorgan/phinx/composer.json
r2285656 r2434037 34 34 }, 35 35 "require-dev": { 36 "ext-json": "*", 36 37 "phpunit/phpunit": ">=5.7,<8.0", 37 38 "sebastian/comparator": ">=1.2.3", … … 48 49 } 49 50 }, 51 "suggest": { 52 "ext-json": "Install if using JSON configuration format", 53 "symfony/yaml": "Install if using YAML configuration format" 54 }, 50 55 "scripts": { 51 56 "check": [ -
easycontent/trunk/vendor/robmorgan/phinx/docs/en/commands.rst
r2285656 r2434037 260 260 ]; 261 261 262 Phinx auto-detects which language parser to use for files with ``*.y ml``, ``*.json``, and ``*.php`` extensions. The appropriate263 parser may also be specified via the ``--parser`` and ``-p`` parameters. Anything other than ``"json"`` or ``"php"`` is 264 treated as YAML.262 Phinx auto-detects which language parser to use for files with ``*.yaml``, ``*.yml``, ``*.json``, and ``*.php`` extensions. 263 The appropriate parser may also be specified via the ``--parser`` and ``-p`` parameters. Anything other than ``"json"`` or 264 ``"php"`` is treated as YAML. 265 265 266 266 When using a PHP array, you can provide a ``connection`` key with an existing PDO instance. It is also important to pass … … 331 331 { 332 332 333 $phinx = new PhinxApplication(); 333 $phinx = new PhinxApplication(); 334 334 $command = $phinx->find('migrate'); 335 335 … … 339 339 '--configuration' => '/path/to/config/phinx.yml' 340 340 ]; 341 341 342 342 $input = new ArrayInput($arguments); 343 343 $returnCode = $command->run(new ArrayInput($arguments), $output); 344 344 // ... 345 345 } 346 346 347 347 Here, you are instantianting the ``PhinxApplication``, telling it to find the ``migrate`` 348 348 command, defining the arguments to pass to it (which match the commandline arguments and flags), -
easycontent/trunk/vendor/robmorgan/phinx/docs/en/configuration.rst
r2285656 r2434037 8 8 creates a default file in the root of your project directory. By default, this 9 9 file uses the YAML data serialization format, but you can use the ``--format`` 10 command line option to specify either ``y ml``, ``json``, or ``php``.10 command line option to specify either ``yaml``, ``yml``, ``json``, or ``php``. 11 11 12 12 If a ``--configuration`` command line option is given, Phinx will load the 13 specified file. Otherwise, it will attempt to find ``phinx.php``, ``phinx.json`` or14 ``phinx.yml`` and load the first file found. See the :doc:`Commands <commands>`15 chapter for more information.13 specified file. Otherwise, it will attempt to find ``phinx.php``, ``phinx.json``, 14 ``phinx.yml``, or ``phinx.yaml`` and load the first file found. See the 15 :doc:`Commands <commands>` chapter for more information. 16 16 17 17 .. warning:: -
easycontent/trunk/vendor/robmorgan/phinx/docs/fr/configuration.rst
r2285656 r2434037 10 10 11 11 If a ``--configuration`` command line option is given, Phinx will load the 12 specified file. Otherwise, it will attempt to find ``phinx.php``, ``phinx.json`` or13 ``phinx.yml`` and load the first file found. See the :doc:`Commands <commands>`14 chapter for more information.12 specified file. Otherwise, it will attempt to find ``phinx.php``, ``phinx.json``, 13 ``phinx.yml`` or ``phinx.yaml`` and load the first file found. See the 14 :doc:`Commands <commands>` chapter for more information. 15 15 16 16 .. warning:: -
easycontent/trunk/vendor/robmorgan/phinx/docs/ja/configuration.rst
r2285656 r2434037 10 10 11 11 ``--configuration`` コマンドラインオプションが与えられた場合、Phinx は指定されたファイルを 12 ロードします。それ以外の場合は、 ``phinx.php`` 、 ``phinx.json`` または ``phinx.yml``13 を見つけて、最初に見つかったファイルを読み込みます。詳しくは、 :doc:`コマンド <commands>` 14 の章をご覧下さい。12 ロードします。それ以外の場合は、 ``phinx.php`` 、 ``phinx.json`` , ``phinx.yml``, 13 または ``phinx.yaml`` を見つけて、最初に見つかったファイルを読み込みます。詳しくは、 14 :doc:`コマンド <commands>` の章をご覧下さい。 15 15 16 16 .. warning:: -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Config/Config.php
r2285656 r2434037 64 64 public static function fromYaml($configFilePath) 65 65 { 66 if (!class_exists('Symfony\\Component\\Yaml\\Yaml', true)) { 67 throw new RuntimeException('Missing yaml parser, symfony/yaml package is not installed.'); 68 } 69 66 70 $configFile = file_get_contents($configFilePath); 67 71 $configArray = Yaml::parse($configFile); … … 88 92 public static function fromJson($configFilePath) 89 93 { 94 if (!function_exists('json_decode')) { 95 throw new RuntimeException("Need to install JSON PHP extension to use JSON config"); 96 } 97 90 98 $configArray = json_decode(file_get_contents($configFilePath), true); 91 99 if (!is_array($configArray)) { … … 159 167 } 160 168 161 return $ environments[$name];169 return $this->parseAgnosticDsn($environments[$name]); 162 170 } 163 171 … … 366 374 { 367 375 // Get environment variables 368 // $_ENV is empty because variables_order does not include it normally 376 // Depending on configuration of server / OS and variables_order directive, 377 // environment variables either end up in $_SERVER (most likely) or $_ENV, 378 // so we search through both 369 379 $tokens = []; 370 foreach ( $_SERVERas $varname => $varvalue) {380 foreach (array_merge($_ENV, $_SERVER) as $varname => $varvalue) { 371 381 if (strpos($varname, 'PHINX_') === 0) { 372 382 $tokens['%%' . $varname . '%%'] = $varvalue; … … 412 422 413 423 /** 424 * Parse a database-agnostic DSN into individual options. 425 * 426 * @param array $options Options 427 * 428 * @return array 429 */ 430 protected function parseAgnosticDsn(array $options) 431 { 432 if (isset($options['dsn']) && is_string($options['dsn'])) { 433 $regex = '#^(?P<adapter>[^\\:]+)\\://(?:(?P<user>[^\\:@]+)(?:\\:(?P<pass>[^@]*))?@)?' 434 . '(?P<host>[^\\:@/]+)(?:\\:(?P<port>[1-9]\\d*))?/(?P<name>[^\?]+)(?:\?(?P<query>.*))?$#'; 435 if (preg_match($regex, trim($options['dsn']), $parsedOptions)) { 436 $additionalOpts = []; 437 if (isset($parsedOptions['query'])) { 438 parse_str($parsedOptions['query'], $additionalOpts); 439 } 440 $validOptions = ['adapter', 'user', 'pass', 'host', 'port', 'name']; 441 $parsedOptions = array_filter(array_intersect_key($parsedOptions, array_flip($validOptions))); 442 $options = array_merge($additionalOpts, $parsedOptions, $options); 443 unset($options['dsn']); 444 } 445 } 446 447 return $options; 448 } 449 450 /** 414 451 * @inheritDoc 415 452 */ -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Console/Command/AbstractCommand.php
r2285656 r2434037 234 234 } 235 235 236 $possibleConfigFiles = ['phinx.php', 'phinx.json', 'phinx.y ml'];236 $possibleConfigFiles = ['phinx.php', 'phinx.json', 'phinx.yaml', 'phinx.yml']; 237 237 foreach ($possibleConfigFiles as $configFile) { 238 238 try { 239 return $locator->locate($configFile, $cwd, $first =true);239 return $locator->locate($configFile, $cwd, true); 240 240 } catch (InvalidArgumentException $exception) { 241 241 $lastException = $exception; … … 273 273 $parser = 'php'; 274 274 break; 275 case 'yaml': 275 276 case 'yml': 276 277 default: -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Console/Command/Init.php
r2285656 r2434037 51 51 protected function execute(InputInterface $input, OutputInterface $output) 52 52 { 53 $path = $this->resolvePath($input);54 53 $format = strtolower($input->getOption('format')); 54 $path = $this->resolvePath($input, $format); 55 55 $this->writeConfig($path, $format); 56 56 … … 64 64 * 65 65 * @param \Symfony\Component\Console\Input\InputInterface $input Interface implemented by all input classes. 66 * @param string $format Format to resolve for 66 67 * 67 68 * @throws \InvalidArgumentException … … 69 70 * @return string 70 71 */ 71 protected function resolvePath(InputInterface $input )72 protected function resolvePath(InputInterface $input, $format) 72 73 { 73 74 // get the migration path from the config 74 75 $path = (string)$input->getArgument('path'); 75 76 76 $format = strtolower($input->getOption('format')); 77 if (!in_array($format, ['yml', 'json', 'php'])) { 77 if (!in_array($format, ['yaml', 'yml', 'json', 'php'])) { 78 78 throw new InvalidArgumentException(sprintf( 79 'Invalid format "%s". Format must be either y ml, json, or php.',79 'Invalid format "%s". Format must be either yaml, yml, json, or php.', 80 80 $format 81 81 )); … … 135 135 } 136 136 137 if ($format === 'yaml') { 138 $format = 'yml'; 139 } 140 137 141 // load the config template 138 142 if (is_dir(__DIR__ . '/../../../data/Phinx')) { 139 143 $contents = file_get_contents(__DIR__ . '/../../../data/Phinx/' . self::FILE_NAME . '.' . $format . '.dist'); 140 } elseif ($format === 'yml' ) {141 $contents = file_get_contents(__DIR__ . '/../../../../' . self::FILE_NAME . '. ' . $format);144 } elseif ($format === 'yml' || $format === 'yaml') { 145 $contents = file_get_contents(__DIR__ . '/../../../../' . self::FILE_NAME . '.yml'); 142 146 } else { 143 147 throw new RuntimeException(sprintf( -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php
r2285656 r2434037 239 239 240 240 array_unshift($columns, $column); 241 if (isset($options['primary_key']) && (array)$options['id'] !== (array)$options['primary_key']) { 242 throw new InvalidArgumentException('You cannot enable an auto incrementing ID field and a primary key'); 243 } 241 244 $options['primary_key'] = $options['id']; 242 245 } -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php
r2285656 r2434037 371 371 } 372 372 373 $rows = $this->fetchAll(sprintf('SELECT * FROM %s ORDER BY %s', $this->getSchemaTableName(), $orderBy)); 373 // This will throw an exception if doing a --dry-run without any migrations as phinxlog 374 // does not exist, so in that case, we can just expect to trivially return empty set 375 try { 376 $rows = $this->fetchAll(sprintf('SELECT * FROM %s ORDER BY %s', $this->quoteTableName($this->getSchemaTableName()), $orderBy)); 377 } catch (PDOException $e) { 378 if (!$this->isDryRunEnabled()) { 379 throw $e; 380 } 381 $rows = []; 382 } 383 374 384 foreach ($rows as $version) { 375 385 $result[$version['version']] = $version; … … 425 435 sprintf( 426 436 'UPDATE %1$s SET %2$s = CASE %2$s WHEN %3$s THEN %4$s ELSE %3$s END, %7$s = %7$s WHERE %5$s = \'%6$s\';', 427 $this-> getSchemaTableName(),437 $this->quoteTableName($this->getSchemaTableName()), 428 438 $this->quoteColumnName('breakpoint'), 429 439 $this->castToBool(true), … … 446 456 sprintf( 447 457 'UPDATE %1$s SET %2$s = %3$s, %4$s = %4$s WHERE %2$s <> %3$s;', 448 $this-> getSchemaTableName(),458 $this->quoteTableName($this->getSchemaTableName()), 449 459 $this->quoteColumnName('breakpoint'), 450 460 $this->castToBool(false), … … 483 493 sprintf( 484 494 'UPDATE %1$s SET %2$s = %3$s, %4$s = %4$s WHERE %5$s = \'%6$s\';', 485 $this-> getSchemaTableName(),495 $this->quoteTableName($this->getSchemaTableName()), 486 496 $this->quoteColumnName('breakpoint'), 487 497 $this->castToBool($state), -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PostgresAdapter.php
r2285656 r2434037 208 208 209 209 array_unshift($columns, $column); 210 if (isset($options['primary_key']) && (array)$options['id'] !== (array)$options['primary_key']) { 211 throw new InvalidArgumentException('You cannot enable an auto incrementing ID field and a primary key'); 212 } 210 213 $options['primary_key'] = $options['id']; 211 214 } -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/SqlServerAdapter.php
r2285656 r2434037 228 228 229 229 array_unshift($columns, $column); 230 if (isset($options['primary_key']) && (array)$options['id'] !== (array)$options['primary_key']) { 231 throw new InvalidArgumentException('You cannot enable an auto incrementing ID field and a primary key'); 232 } 230 233 $options['primary_key'] = $options['id']; 231 234 } -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Migration/Manager/Environment.php
r2285656 r2434037 191 191 public function getOptions() 192 192 { 193 return $this->parseAgnosticDsn($this->options); 194 } 195 196 /** 197 * Parse a database-agnostic DSN into individual options. 198 * 199 * @param array $options Options 200 * 201 * @return array 202 */ 203 protected function parseAgnosticDsn(array $options) 204 { 205 if (isset($options['dsn']) && is_string($options['dsn'])) { 206 $regex = '#^(?P<adapter>[^\\:]+)\\://(?:(?P<user>[^\\:@]+)(?:\\:(?P<pass>[^@]*))?@)?' 207 . '(?P<host>[^\\:@/]+)(?:\\:(?P<port>[1-9]\\d*))?/(?P<name>[^\?]+)(?:\?(?P<query>.*))?$#'; 208 if (preg_match($regex, trim($options['dsn']), $parsedOptions)) { 209 $additionalOpts = []; 210 if (isset($parsedOptions['query'])) { 211 parse_str($parsedOptions['query'], $additionalOpts); 212 } 213 $validOptions = ['adapter', 'user', 'pass', 'host', 'port', 'name']; 214 $parsedOptions = array_filter(array_intersect_key($parsedOptions, array_flip($validOptions))); 215 $options = array_merge($additionalOpts, $parsedOptions, $options); 216 unset($options['dsn']); 217 } 218 } 219 220 return $options; 193 return $this->options; 221 194 } 222 195 -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Migration/Migration.template.php.dist
r2189682 r2434037 11 11 * 12 12 * More information on writing migrations is available here: 13 * http ://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class13 * https://book.cakephp.org/phinx/0/en/migrations.html 14 14 * 15 15 * The following commands can be used in this method and Phinx will -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Migration/MigrationInterface.php
r2285656 r2434037 141 141 * Executes a SQL statement and returns the result as an array. 142 142 * 143 * @param string $sql SQL 144 * 145 * @return array 143 * To improve IDE auto-completion possibility, you can overwrite the query method 144 * phpDoc in your (typically custom abstract parent) migration class, where you can set 145 * the return type by the adapter in your current use. 146 * 147 * @param string $sql SQL 148 * 149 * @return mixed 146 150 */ 147 151 public function query($sql); -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Seed/Seed.template.php.dist
r2189682 r2434037 12 12 * 13 13 * More information on writing seeders is available here: 14 * http ://docs.phinx.org/en/latest/seeding.html14 * https://book.cakephp.org/phinx/0/en/seeding.html 15 15 */ 16 16 public function run() -
easycontent/trunk/vendor/robmorgan/phinx/src/Phinx/Wrapper/TextWrapper.php
r2285656 r2434037 84 84 $command += ['-p' => $this->getOption('parser')]; 85 85 } 86 if ($this->hasOption('format')) { 87 $command += ['-f' => $this->getOption('format')]; 88 } 86 89 87 90 return $this->executeRun($command); … … 169 172 if (isset($target)) { 170 173 // Need to use isset() with rollback, because -t0 is a valid option! 171 // See http ://docs.phinx.org/en/latest/commands.html#the-rollback-command174 // See https://book.cakephp.org/phinx/0/en/commands.html#the-rollback-command 172 175 $command += ['-t' => $target]; 173 176 } -
easycontent/trunk/views/admin/pages/connection.php
r2327436 r2434037 57 57 </tr> 58 58 <tr> 59 <th scope="row"> 60 <label for="msar-url-input"> 61 <?= esc_html__( 'Current site URL', EASYCONTENT_TXTDOMAIN ) ?> 62 </label> 63 </th> 64 <td> 65 <?php if ( $referer ) : ?> 66 <span id="msar-url-wrapper"> 67 <?= esc_html( $referer ) ?> 68 <a href="#" id="msar-change-url-button"> 69 <?= esc_html__( 'Change', EASYCONTENT_TXTDOMAIN ) ?> 70 </a> 71 </span> 72 <?php endif ?> 73 74 <input 75 id="msar-url-input" 76 class="regular-text" 77 name="<?= esc_attr( $formView['url']->vars['full_name'] ) ?>" 78 type="<?= esc_attr( $referer ? 'hidden' : 'text' ) ?>" 79 value="<?= esc_attr( $referer ?: '' ) ?>" 80 placeholder="<?= esc_attr__( 'Please enter current site URL', EASYCONTENT_TXTDOMAIN ) ?>"> 81 82 <?php if ( ! $formView['url']->vars['valid'] ) : ?> 83 <?php foreach ( $formView['url']->vars['errors'] as $error ) : 84 /** @var Symfony\Component\Form\FormError $error */ ?> 85 <p style="color: red;"><?= esc_html( $error->getMessage() ) ?></p> 86 <?php endforeach ?> 87 <?php endif ?> 88 59 <th scope="row" style="padding-top: 0; padding-bottom: 0;"> </th> 60 <td style="padding-top: 0; padding-bottom: 0;"> 89 61 <p class="description" id="tagline-ec-private-api-key"> 90 <a href="https://easycontent.io/help-article/wordpress-integration" >62 <a href="https://easycontent.io/help-article/wordpress-integration" target="_blank"> 91 63 <?= esc_html__( 'How to get your API key?', EASYCONTENT_TXTDOMAIN ) ?> 92 64 </a> … … 107 79 </form> 108 80 </div> 109 110 <script type="application/javascript">111 (function($) {112 $(document).ready(function() {113 $('#msar-change-url-button').click(function(e) {114 e.preventDefault();115 116 $('#msar-url-wrapper').hide();117 $('#msar-url-input').attr('type', 'text');118 });119 });120 })(jQuery);121 </script>
Note: See TracChangeset
for help on using the changeset viewer.