@@ -33,14 +33,14 @@ |
||
| 33 | 33 | public function __invoke( $resource ) |
| 34 | 34 | { |
| 35 | 35 | /** |
| 36 | - * @var \Zend\Permissions\Acl\Acl $acl |
|
| 36 | + * @var \Zend\Permissions\Acl\Acl $acl |
|
| 37 | 37 | **/ |
| 38 | 38 | $acl = $this->view->navigation()->getAcl(); |
| 39 | 39 | if (empty($resource) || !$acl->hasResource($resource) ) { |
| 40 | 40 | return true; |
| 41 | 41 | } |
| 42 | 42 | /** |
| 43 | - * @var \Admin\Entity\User $user |
|
| 43 | + * @var \Admin\Entity\User $user |
|
| 44 | 44 | **/ |
| 45 | 45 | $user = $this->view->zfcUserIdentity(); // ->getIdentity(); |
| 46 | 46 | if ($user) { // ($this->getAuthService()->hasIdentity()) { |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | $tableQueries = array(); |
| 79 | 79 | foreach ($tables as $table) { //while ($table = $tables->current()) { |
| 80 | 80 | $tableName = $table["Tables_in_".$config["db"]["database"]]; |
| 81 | - // describe tables |
|
| 81 | + // describe tables |
|
| 82 | 82 | $tableSql = $db->query("SHOW CREATE TABLE `" . $tableName . "`;"); |
| 83 | 83 | $tableCreate = $tableSql->execute(); |
| 84 | 84 | $tableSpec = $tableCreate->current(); |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | trait ControllerTranslatorTrait { |
| 24 | 24 | |
| 25 | - /** |
|
| 25 | + /** |
|
| 26 | 26 | * |
| 27 | 27 | * @var \Zend\I18n\Translator\Translator |
| 28 | 28 | */ |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | class BaseActionController extends AbstractActionController implements Dispatchable |
| 36 | 36 | { |
| 37 | - //use ServiceLocatorAwareTrait; |
|
| 38 | - use ControllerTranslatorTrait; |
|
| 39 | - use ControllerActiontitlesTrait; |
|
| 40 | - use ControllerToolbarTrait; |
|
| 37 | + //use ServiceLocatorAwareTrait; |
|
| 38 | + use ControllerTranslatorTrait; |
|
| 39 | + use ControllerActiontitlesTrait; |
|
| 40 | + use ControllerToolbarTrait; |
|
| 41 | 41 | |
| 42 | 42 | //protected $serviceLocator; |
| 43 | 43 | |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function __construct( ServiceLocatorInterface $serviceLocator ) |
| 50 | 50 | { |
| 51 | - if ( $serviceLocator ) { |
|
| 52 | - $this->setServiceLocator($serviceLocator); |
|
| 53 | - } |
|
| 51 | + if ( $serviceLocator ) { |
|
| 52 | + $this->setServiceLocator($serviceLocator); |
|
| 53 | + } |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -147,17 +147,17 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function isXHR() |
| 149 | 149 | { |
| 150 | - /** |
|
| 151 | - * @var \Zend\Http\PhpEnvironment\Request|\Zend\Http\Request $request |
|
| 152 | - */ |
|
| 153 | - $request = $this->getRequest(); |
|
| 154 | - if ( |
|
| 155 | - ($request instanceof \Zend\Http\PhpEnvironment\Request) || |
|
| 156 | - ($request instanceof \Zend\Http\Request) |
|
| 157 | - ) { |
|
| 158 | - return ( $request->isXmlHttpRequest() ); |
|
| 159 | - } |
|
| 160 | - return (false); |
|
| 150 | + /** |
|
| 151 | + * @var \Zend\Http\PhpEnvironment\Request|\Zend\Http\Request $request |
|
| 152 | + */ |
|
| 153 | + $request = $this->getRequest(); |
|
| 154 | + if ( |
|
| 155 | + ($request instanceof \Zend\Http\PhpEnvironment\Request) || |
|
| 156 | + ($request instanceof \Zend\Http\Request) |
|
| 157 | + ) { |
|
| 158 | + return ( $request->isXmlHttpRequest() ); |
|
| 159 | + } |
|
| 160 | + return (false); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -60,20 +60,20 @@ discard block |
||
| 60 | 60 | var $config = array();//updater configuration |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * Constructor |
|
| 63 | + * Constructor |
|
| 64 | 64 | * |
| 65 | - * @access public |
|
| 66 | - */ |
|
| 65 | + * @access public |
|
| 66 | + */ |
|
| 67 | 67 | public function __construct() |
| 68 | 68 | { |
| 69 | 69 | $this->init(); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | - * Constructor |
|
| 73 | + * Constructor |
|
| 74 | 74 | * |
| 75 | - * @access public |
|
| 76 | - */ |
|
| 75 | + * @access public |
|
| 76 | + */ |
|
| 77 | 77 | public function dbStructUpdater() |
| 78 | 78 | { |
| 79 | 79 | $this->init(); |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * merges current updater config with the given one |
|
| 99 | + * merges current updater config with the given one |
|
| 100 | 100 | * |
| 101 | - * @param assoc_array $config new configuration values |
|
| 102 | - */ |
|
| 101 | + * @param assoc_array $config new configuration values |
|
| 102 | + */ |
|
| 103 | 103 | public function setConfig($config=array()) |
| 104 | 104 | { |
| 105 | 105 | if (is_array($config)) { |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | - * Returns array of update SQL with default options, $source, $dest - database structures |
|
| 111 | + * Returns array of update SQL with default options, $source, $dest - database structures |
|
| 112 | 112 | * |
| 113 | - * @access public |
|
| 114 | - * @param string $source structure dump of database to update |
|
| 115 | - * @param string $dest structure dump of the reference database |
|
| 116 | - * @param bool $asString if true - result will be a string, otherwise - array |
|
| 117 | - * @return array|string update sql statements - in array or string (separated with ';') |
|
| 118 | - */ |
|
| 113 | + * @access public |
|
| 114 | + * @param string $source structure dump of database to update |
|
| 115 | + * @param string $dest structure dump of the reference database |
|
| 116 | + * @param bool $asString if true - result will be a string, otherwise - array |
|
| 117 | + * @return array|string update sql statements - in array or string (separated with ';') |
|
| 118 | + */ |
|
| 119 | 119 | public function getUpdates($source, $dest, $asString=false) |
| 120 | 120 | { |
| 121 | 121 | $result = $asString?'':array(); |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | - * Filters comparison result and lefts only sync actions allowed by 'updateTypes' option |
|
| 139 | - */ |
|
| 138 | + * Filters comparison result and lefts only sync actions allowed by 'updateTypes' option |
|
| 139 | + */ |
|
| 140 | 140 | public function filterDiffs($compRes) |
| 141 | 141 | { |
| 142 | 142 | $result = array(); |
@@ -185,9 +185,9 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
| 188 | - * Gets structured general info about the databases diff : |
|
| 189 | - * array(sourceOrphans=>array(...), destOrphans=>array(...), different=>array(...)) |
|
| 190 | - */ |
|
| 188 | + * Gets structured general info about the databases diff : |
|
| 189 | + * array(sourceOrphans=>array(...), destOrphans=>array(...), different=>array(...)) |
|
| 190 | + */ |
|
| 191 | 191 | public function getDiffInfo($compRes) |
| 192 | 192 | {
|
| 193 | 193 | if (!is_array($compRes)) { |
@@ -211,20 +211,20 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | - * Makes comparison of the given database structures, support some options |
|
| 214 | + * Makes comparison of the given database structures, support some options |
|
| 215 | 215 | * |
| 216 | - * @access private |
|
| 217 | - * @param string $source and $dest are strings - database tables structures |
|
| 218 | - * @return array |
|
| 219 | - * - table (array) |
|
| 220 | - * - destOrphan (boolean) |
|
| 221 | - * - sourceOrphan (boolean) |
|
| 222 | - * - differs (array) OR (boolean) false if no diffs |
|
| 223 | - * - [0](array) |
|
| 224 | - * - source (string) structure definition line in the out-of-date table |
|
| 225 | - * - dest (string) structure definition line in the reference table |
|
| 226 | - * - [1](array) ... |
|
| 227 | - */ |
|
| 216 | + * @access private |
|
| 217 | + * @param string $source and $dest are strings - database tables structures |
|
| 218 | + * @return array |
|
| 219 | + * - table (array) |
|
| 220 | + * - destOrphan (boolean) |
|
| 221 | + * - sourceOrphan (boolean) |
|
| 222 | + * - differs (array) OR (boolean) false if no diffs |
|
| 223 | + * - [0](array) |
|
| 224 | + * - source (string) structure definition line in the out-of-date table |
|
| 225 | + * - dest (string) structure definition line in the reference table |
|
| 226 | + * - [1](array) ... |
|
| 227 | + */ |
|
| 228 | 228 | private function compare($source, $dest) |
| 229 | 229 | { |
| 230 | 230 | $this->sourceStruct = $source; |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
| 273 | - * Retrieves list of table names from the database structure dump |
|
| 273 | + * Retrieves list of table names from the database structure dump |
|
| 274 | 274 | * |
| 275 | - * @access private |
|
| 276 | - * @param string $struct database structure listing |
|
| 277 | - */ |
|
| 275 | + * @access private |
|
| 276 | + * @param string $struct database structure listing |
|
| 277 | + */ |
|
| 278 | 278 | private function getTableList($struct) |
| 279 | 279 | { |
| 280 | 280 | $result = array(); |
@@ -288,14 +288,14 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
| 291 | - * Retrieves table structure definition from the database structure dump |
|
| 291 | + * Retrieves table structure definition from the database structure dump |
|
| 292 | 292 | * |
| 293 | - * @access private |
|
| 294 | - * @param string $struct database structure listing |
|
| 295 | - * @param string $tab table name |
|
| 296 | - * @param bool $removeDatabase - either to remove database name in "CREATE TABLE database.tab"-like declarations |
|
| 297 | - * @return string table structure definition |
|
| 298 | - */ |
|
| 293 | + * @access private |
|
| 294 | + * @param string $struct database structure listing |
|
| 295 | + * @param string $tab table name |
|
| 296 | + * @param bool $removeDatabase - either to remove database name in "CREATE TABLE database.tab"-like declarations |
|
| 297 | + * @return string table structure definition |
|
| 298 | + */ |
|
| 299 | 299 | private function getTabSql($struct, $tab, $removeDatabase=true) |
| 300 | 300 | { |
| 301 | 301 | $result = ''; |
@@ -323,8 +323,8 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
| 326 | - * Splits table sql into indexed array |
|
| 327 | - */ |
|
| 326 | + * Splits table sql into indexed array |
|
| 327 | + */ |
|
| 328 | 328 | public function splitTabSql($sql) |
| 329 | 329 | { |
| 330 | 330 | $result = array(); |
@@ -365,18 +365,18 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | - * returns array of fields or keys definitions that differs in the given tables structure |
|
| 368 | + * returns array of fields or keys definitions that differs in the given tables structure |
|
| 369 | 369 | * |
| 370 | - * @access private |
|
| 371 | - * @param sring $sourceSql table structure |
|
| 372 | - * @param sring $destSql right table structure supports some $options |
|
| 373 | - * supports some $options |
|
| 374 | - * @return array |
|
| 375 | - * - [0] |
|
| 376 | - * - source (string) out-of-date table field definition |
|
| 377 | - * - dest (string) reference table field definition |
|
| 378 | - * - [1]... |
|
| 379 | - */ |
|
| 370 | + * @access private |
|
| 371 | + * @param sring $sourceSql table structure |
|
| 372 | + * @param sring $destSql right table structure supports some $options |
|
| 373 | + * supports some $options |
|
| 374 | + * @return array |
|
| 375 | + * - [0] |
|
| 376 | + * - source (string) out-of-date table field definition |
|
| 377 | + * - dest (string) reference table field definition |
|
| 378 | + * - [1]... |
|
| 379 | + */ |
|
| 380 | 380 | private function compareSql($sourceSql, $destSql)//$sourceSql, $destSql |
| 381 | 381 | { |
| 382 | 382 | $result = array(); |
@@ -439,14 +439,14 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
| 442 | - * Transforms table structure defnition line into key=>value pair where the key is a string that uniquely |
|
| 443 | - * defines field or key desribed |
|
| 442 | + * Transforms table structure defnition line into key=>value pair where the key is a string that uniquely |
|
| 443 | + * defines field or key desribed |
|
| 444 | 444 | * |
| 445 | - * @access private |
|
| 446 | - * @param string $line field definition string |
|
| 447 | - * @return array array with single key=>value pair as described in the description |
|
| 448 | - * implements some options |
|
| 449 | - */ |
|
| 445 | + * @access private |
|
| 446 | + * @param string $line field definition string |
|
| 447 | + * @return array array with single key=>value pair as described in the description |
|
| 448 | + * implements some options |
|
| 449 | + */ |
|
| 450 | 450 | private function processLine($line) |
| 451 | 451 | { |
| 452 | 452 | $options = $this->config; |
@@ -484,14 +484,14 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /** |
| 487 | - * Takes an output of compare() method to generate the set of sql needed to update source table to make it |
|
| 488 | - * look as a destination one |
|
| 487 | + * Takes an output of compare() method to generate the set of sql needed to update source table to make it |
|
| 488 | + * look as a destination one |
|
| 489 | 489 | * |
| 490 | - * @access private |
|
| 491 | - * @param array $diff compare() method output |
|
| 492 | - * @return array list of sql statements |
|
| 493 | - * supports query generation options |
|
| 494 | - */ |
|
| 490 | + * @access private |
|
| 491 | + * @param array $diff compare() method output |
|
| 492 | + * @return array list of sql statements |
|
| 493 | + * supports query generation options |
|
| 494 | + */ |
|
| 495 | 495 | private function getDiffSql($diff)//maybe add option to ommit or force 'IF NOT EXISTS', skip autoincrement |
| 496 | 496 | { |
| 497 | 497 | $options = $this->config; |
@@ -548,14 +548,14 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | /** |
| 551 | - * Compiles update sql |
|
| 551 | + * Compiles update sql |
|
| 552 | 552 | * |
| 553 | - * @access private |
|
| 554 | - * @param string $action - 'drop', 'add' or 'modify' |
|
| 555 | - * @param string $tab table name |
|
| 556 | - * @param string $sql definition of the element to change |
|
| 557 | - * @return string update sql |
|
| 558 | - */ |
|
| 553 | + * @access private |
|
| 554 | + * @param string $action - 'drop', 'add' or 'modify' |
|
| 555 | + * @param string $tab table name |
|
| 556 | + * @param string $sql definition of the element to change |
|
| 557 | + * @return string update sql |
|
| 558 | + */ |
|
| 559 | 559 | private function getActionSql($action, $tab, $sql) |
| 560 | 560 | { |
| 561 | 561 | $result = 'ALTER TABLE `'.$tab.'` '; |
@@ -621,14 +621,14 @@ discard block |
||
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /** |
| 624 | - * Searches for the position of the next delimiter which is not inside string literal like 'this ; ' or |
|
| 625 | - * like "this ; ". |
|
| 626 | - * |
|
| 627 | - * Handles escaped \" and \'. Also handles sql comments. |
|
| 628 | - * Actualy it is regex-based Finit State Machine (FSN) |
|
| 629 | - * |
|
| 630 | - * $skipInBrackets - if true, delimiter will be skipped if located inside (brackets) which are not string literals or comment parts |
|
| 631 | - */ |
|
| 624 | + * Searches for the position of the next delimiter which is not inside string literal like 'this ; ' or |
|
| 625 | + * like "this ; ". |
|
| 626 | + * |
|
| 627 | + * Handles escaped \" and \'. Also handles sql comments. |
|
| 628 | + * Actualy it is regex-based Finit State Machine (FSN) |
|
| 629 | + * |
|
| 630 | + * $skipInBrackets - if true, delimiter will be skipped if located inside (brackets) which are not string literals or comment parts |
|
| 631 | + */ |
|
| 632 | 632 | public function getDelimPos($string, $offset=0, $delim=';', $skipInBrackets=false) |
| 633 | 633 | { |
| 634 | 634 | $stack = array(); |
@@ -701,9 +701,9 @@ discard block |
||
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | /** |
| 704 | - * works the same as getDelimPos except returns position of the first occurence of the delimiter starting from |
|
| 705 | - * the end of the string |
|
| 706 | - */ |
|
| 704 | + * works the same as getDelimPos except returns position of the first occurence of the delimiter starting from |
|
| 705 | + * the end of the string |
|
| 706 | + */ |
|
| 707 | 707 | public function getDelimRpos($string, $offset=0, $delim=';', $skipInBrackets=false) |
| 708 | 708 | { |
| 709 | 709 | $pos = $this->getDelimPos($string, $offset, $delim, $skipInBrackets); |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | trait ControllerTranslatorTrait { |
| 24 | 24 | |
| 25 | - /** |
|
| 25 | + /** |
|
| 26 | 26 | * |
| 27 | 27 | * @var \Zend\I18n\Translator\Translator |
| 28 | 28 | */ |