Overview

Namespaces

  • Cron
  • None

Classes

  • _HtmlGrid_TableOut
  • _TransactionModel_RawSaveOperation
  • AccessControlComponent
  • AccessControlHelper
  • ActionListHelper
  • ActiveDirectoryUtils
  • AddCurrentPidToSchedulingShellCallLogs
  • AnonymousFunctionOperation
  • ArrayUtil
  • AssociationIntegrityBehavior
  • AtomicOperation
  • AuthenticationComponent
  • AuthenticationController
  • AuthenticationUser
  • AutocompleteDatasourceComponent
  • BaseModelComponent
  • Basics
  • CakeLayersHelper
  • CheckAndRunShell
  • ClassSearcher
  • CommandLineUtil
  • CommonValidationBehavior
  • ConfigurableShellCallsSchedulingTask
  • ConfigurationKey
  • ConfigurationKeys
  • ConfigurationKeysController
  • Context
  • ContextComponent
  • ContextHelper
  • Contexts
  • ControllerInspector
  • ControllerMenuHelper
  • CreateJournalingTables
  • CreateTableConfigurationKeys
  • CreateTableSchedulingConfigurableShellCalls
  • CreateTableSchedulingShellCallLogs
  • CreateTableSettedConfigurationKeys
  • CreateTableUserResetPasswordRequests
  • CreateTableUsers
  • CronSchedulingInstaller
  • CronValidationBehavior
  • CssBox
  • CssController
  • CssProperties
  • CssShell
  • CsvUtil
  • CustomDataModel
  • DatasourceDumperManager
  • DateTimeInput
  • DependencyShell
  • DetailHelper
  • DumperShell
  • ExtendedFieldsAccessControl
  • ExtendedFieldSet
  • ExtendedFieldSetHelper
  • ExtendedFieldsParser
  • ExtendedFormHelper
  • ExtendedHasManyAppModel
  • ExtendedOperationsBehavior
  • FieldDefinition
  • FieldRowDefinition
  • FieldSetDefinition
  • FieldSetLayoutHelper
  • FileOperations
  • FileOperations_Rename
  • FileOperations_SymLink
  • FileOperations_Touch
  • FileOperations_Unlink
  • FileSystem
  • FixConfigurationKeysPrimaryKey
  • FixSettedConfigurationKeysPrimaryKey
  • HasManyUtilsBehavior
  • HtmlDocument
  • HtmlGrid
  • HtmlGrid_Cell
  • HttpClient
  • HttpResponse
  • ImapClient
  • ImapMailBox
  • ImapParserShell
  • IncludePath
  • InputMasked
  • InputSearchable
  • InputsOnSubmit
  • InstallShell
  • JenkinsBuildShell
  • Journal
  • JournalDetail
  • JournalizedBehavior
  • JsonResponseComponent
  • LayoutsHelper
  • Ldap
  • LdapUtils
  • ListFieldSet
  • ListFieldSetHelper
  • ListsHelper
  • MailParser
  • Make
  • MenuHelper
  • MigrationAllPluginsShell
  • ModelOperations
  • ModelOperations_Delete
  • ModelOperations_Save
  • ModelTraverser
  • MysqlDumper
  • OpenLdapUtils
  • PaginatorUtilComponent
  • PaginatorUtilComponentFilter
  • PaginatorUtilHelper
  • Plugin
  • PluginManager
  • Reflections
  • RenameEnabledToActiveFromUsersTable
  • RunShellCallShell
  • ScaffoldUtilComponent
  • ScaffoldUtilHelper
  • Scheduling
  • SchedulingConfigurableShellCall
  • SchedulingConfigurableShellCallsController
  • SchedulingShellCallLog
  • SchedulingShellCallLogsController
  • SettedConfigurationKey
  • StuffreposPluginsRename
  • TimeZoneBehavior
  • TransactionModel
  • TransactionOperation
  • Translator
  • TranslatorShell
  • User
  • UserAuthenticationComponent
  • UserChangePassword
  • UserResetPassword
  • UserResetPasswordRequest
  • UserResetPasswordRequestSubmission
  • UsersController
  • ViewUtilHelper

Interfaces

  • AccessControlFilter
  • CommitableOperation
  • DatasourceDumper
  • MakeListener
  • SchedulingInstaller
  • TasksObject
  • UndoableOperation

Exceptions

  • LdapObjectNotWritableException
  • ModelTraverserException
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: class DatasourceDumperManager {
 4: 
 5:     /**
 6:      * 
 7:      * @param \DataSource $ds
 8:      * @return DatasourceDumper
 9:      */
10:     public static function getDumper(\DataSource $ds) {
11:         $path = explode('/', $ds->config['datasource']);
12:         $className = end($path) . 'Dumper';
13:         array_pop($path);
14:         $path = array_merge(array('Lib', 'DatasourceDumper'), $path);
15:         $location = implode('/', $path);
16:         $plugins = array_merge(
17:                 array(false)
18:                 , CakePlugin::loaded()
19:         );
20:         foreach ($plugins as $plugin) {
21:             App::uses($className, $plugin ? "$plugin.$location" : $location);
22:             if (class_exists($className)) {
23:                 return new $className;
24:             }
25:         }
26:         throw new Exception("Class \"$className\" not found");
27:     }
28: 
29:     private static function _listDumps() {
30:         $dir = new DirectoryIterator($this->_getDumpsDirectory());
31:         $dumps = array();
32:         while ($dir->valid()) {
33:             if ($dir->isFile()) {
34:                 $dumps[] = $this->_parseDumpFile($dir->getPathname());
35:             }
36:             $dir->next();
37:         }
38:         return $dumps;
39:     }
40: 
41:     private static function _findDump() {
42:         foreach (self::_listDumps() as $dump) {
43:             if ($dump['name'] == $this->dumpName) {
44:                 return $dump;
45:             }
46:         }
47:         return false;
48:     }
49: 
50:     private function _parseDumpFile($filepath) {
51:         $connection = '[_a-zA-Z][_a-zA-Z0-9]*';
52:         $date = '\d{4}\-\d{2}\-\d{2}_\d{2}\-\d{2}\-\d{2}';
53:         $datasource = '([_a-zA-Z][_a-zA-Z0-9]*)(\-[_a-zA-Z][_a-zA-Z0-9]*)*';
54:         $pattern = "/($connection)_($date)_($datasource)/";
55:         if (preg_match($pattern, basename($filepath), $matches)) {
56:             return array(
57:                 'name' => basename($filepath),
58:                 'path' => $filepath,
59:                 'connection' => $matches[1],
60:                 'date' => str_replace('_', ' ', $matches[2]),
61:                 'datasource' => str_replace('-', '/', $matches[3])
62:             );
63:         } else {
64:             throw new Exception("File \"$filepath\" has no dump format");
65:         }
66:     }
67: 
68: }
69: 
API documentation generated by ApiGen 2.8.0