idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
25,900 | public function paginateRaw ( $ count , $ page , $ itemsPerPage ) { $ this -> paginator -> tweak ( $ count , $ itemsPerPage , $ page ) ; $ this -> limit ( $ this -> paginator -> countOffset ( ) , $ this -> paginator -> getItemsPerPage ( ) ) ; return $ this ; } | Paginates a result - set without automatic query guessing |
25,901 | public function paginate ( $ page , $ itemsPerPage , $ column = '1' ) { $ count = $ this -> getCount ( $ column ) ; if ( $ this -> isDriver ( 'mysql' ) || $ this -> isDriver ( 'sqlite' ) ) { $ this -> paginateRaw ( $ count , $ page , $ itemsPerPage ) ; } else { throw new RuntimeException ( 'Smart pagination algorithm is currently supported only for MySQL and SQLite' ) ; } return $ this ; } | Automatically paginates result - set |
25,902 | public function getPrimaryKey ( $ table ) { $ db = $ this -> showKeys ( ) -> from ( $ table ) -> whereEquals ( 'Key_name' , new RawBinding ( 'PRIMARY' ) ) ; return $ db -> query ( 'Column_name' ) ; } | Gets primary out of a table |
25,903 | public function raw ( $ query , array $ bindings = array ( ) ) { if ( ! empty ( $ bindings ) ) { foreach ( $ bindings as $ column => $ value ) { $ this -> bind ( $ column , $ value ) ; } } $ this -> queryBuilder -> raw ( $ query ) ; return $ this ; } | Executes raw query |
25,904 | public function getStmt ( ) { if ( ArrayUtils :: hasAtLeastOneArrayValue ( $ this -> bindings ) ) { throw new RuntimeException ( 'PDO bindings can not contain nested arrays' ) ; } $ log = str_replace ( array_keys ( $ this -> bindings ) , array_values ( $ this -> bindings ) , $ this -> queryBuilder -> getQueryString ( ) ) ; $ stmt = $ this -> pdo -> prepare ( $ this -> queryBuilder -> getQueryString ( ) ) ; $ stmt -> execute ( $ this -> bindings ) ; $ this -> queryLogger -> add ( $ log ) ; $ this -> clear ( ) ; return $ stmt ; } | Returns prepared PDO statement For internal usage only regarding its public visibility |
25,905 | public function queryAll ( $ column = null , $ mode = null ) { if ( is_null ( $ mode ) ) { $ mode = $ this -> pdo -> getAttribute ( PDO :: ATTR_DEFAULT_FETCH_MODE ) ; } $ result = array ( ) ; $ rows = $ this -> getStmt ( ) -> fetchAll ( $ mode ) ; if ( $ column == null ) { $ result = $ rows ; } else { foreach ( $ rows as $ row ) { if ( isset ( $ row [ $ column ] ) ) { $ result [ ] = $ row [ $ column ] ; } else { return false ; } } } if ( $ this -> relationProcessor -> hasQueue ( ) ) { return $ this -> relationProcessor -> process ( $ result ) ; } else { return $ result ; } } | Queries for all result - set |
25,906 | public function query ( $ column = null , $ mode = null ) { if ( is_null ( $ mode ) ) { $ mode = $ this -> pdo -> getAttribute ( PDO :: ATTR_DEFAULT_FETCH_MODE ) ; } $ result = array ( ) ; $ rows = $ this -> getStmt ( ) -> fetch ( $ mode ) ; if ( $ column !== null ) { if ( isset ( $ rows [ $ column ] ) ) { $ result = $ rows [ $ column ] ; } else { $ result = false ; } } else { $ result = $ rows ; } if ( $ this -> relationProcessor -> hasQueue ( ) ) { $ data = $ this -> relationProcessor -> process ( array ( $ result ) ) ; return isset ( $ data [ 0 ] ) ? $ data [ 0 ] : false ; } return $ result ; } | Queries for a single result - set |
25,907 | public function queryScalar ( $ mode = null ) { $ result = $ this -> query ( null , $ mode ) ; if ( is_array ( $ result ) ) { $ result = array_values ( $ result ) ; return isset ( $ result [ 0 ] ) ? $ result [ 0 ] : false ; } return false ; } | Queries for a single result - set returning a value of a first column |
25,908 | public function increment ( $ table , $ column , $ step = 1 ) { $ this -> queryBuilder -> increment ( $ table , $ column , $ step ) ; return $ this ; } | Appends increment condition |
25,909 | public function decrement ( $ table , $ column , $ step = 1 ) { $ this -> queryBuilder -> decrement ( $ table , $ column , $ step ) ; return $ this ; } | Appends decrement condition |
25,910 | public function equals ( $ column , $ value , $ filter = false ) { return $ this -> compare ( $ column , '=' , $ value , $ filter ) ; } | Appends a raw comparison with = operator |
25,911 | public function notEquals ( $ column , $ value , $ filter = false ) { return $ this -> compare ( $ column , '!=' , $ value , $ filter ) ; } | Appends a raw comparison with ! = operator |
25,912 | public function like ( $ column , $ value , $ filter = false ) { return $ this -> compare ( $ column , 'LIKE' , $ value , $ filter ) ; } | Appends a raw comparison with LIKE operator |
25,913 | public function notLike ( $ column , $ value , $ filter = false ) { return $ this -> compare ( $ column , 'NOT LIKE' , $ value , $ filter ) ; } | Appends a raw comparison with NOT LIKE operator |
25,914 | public function greaterThan ( $ column , $ value , $ filter = false ) { return $ this -> compare ( $ column , '>' , $ value , $ filter ) ; } | Appends a raw comparison with > operator |
25,915 | public function lessThan ( $ column , $ value , $ filter = false ) { return $ this -> compare ( $ column , '<' , $ value , $ filter ) ; } | Appends a raw comparison with < operator |
25,916 | public function orWhereBetween ( $ column , $ a , $ b , $ filter = false ) { return $ this -> between ( __FUNCTION__ , $ column , $ a , $ b , $ filter ) ; } | Appends OR WHERE with BETWEEN operator |
25,917 | private function between ( $ method , $ column , $ a , $ b , $ filter ) { if ( ! $ this -> queryBuilder -> isFilterable ( $ filter , array ( $ a , $ b ) ) ) { return $ this ; } if ( $ a instanceof RawSqlFragmentInterface ) { $ x = $ a -> getFragment ( ) ; } if ( $ b instanceof RawSqlFragmentInterface ) { $ y = $ b -> getFragment ( ) ; } if ( ! isset ( $ x ) ) { $ x = $ this -> getUniqPlaceholder ( ) ; } if ( ! isset ( $ y ) ) { $ y = $ this -> getUniqPlaceholder ( ) ; } call_user_func ( array ( $ this -> queryBuilder , $ method ) , $ column , $ x , $ y , $ filter ) ; if ( ! ( $ a instanceof RawSqlFragmentInterface ) ) { $ this -> bind ( $ x , $ a ) ; } if ( ! ( $ b instanceof RawSqlFragmentInterface ) ) { $ this -> bind ( $ y , $ b ) ; } return $ this ; } | Adds WHERE with BETWEEN operator |
25,918 | private function constraint ( $ method , $ column , $ operator , $ value , $ filter ) { if ( ! $ this -> queryBuilder -> isFilterable ( $ filter , $ value ) ) { return $ this ; } call_user_func ( array ( $ this -> queryBuilder , $ method ) , $ column , $ operator , $ this -> createUniqPlaceholder ( $ value ) ) ; return $ this ; } | Adds a constraint to the query |
25,919 | private function whereInValues ( $ method , $ column , $ values , $ filter ) { if ( ! $ this -> queryBuilder -> isFilterable ( $ filter , $ values ) ) { return $ this ; } if ( $ values instanceof RawBindingInterface ) { call_user_func ( array ( $ this -> queryBuilder , $ method ) , $ column , $ values -> getTarget ( ) , $ filter ) ; } elseif ( $ values instanceof RawSqlFragmentInterface ) { call_user_func ( array ( $ this -> queryBuilder , $ method ) , $ column , $ values , $ filter ) ; } else { $ bindings = array ( ) ; foreach ( $ values as $ value ) { $ placeholder = $ this -> getUniqPlaceholder ( ) ; $ bindings [ $ placeholder ] = $ value ; } call_user_func ( array ( $ this -> queryBuilder , $ method ) , $ column , array_keys ( $ bindings ) , $ filter ) ; foreach ( $ bindings as $ key => $ value ) { $ this -> bind ( $ key , $ value ) ; } } return $ this ; } | Internal method to handle WHERE IN methods |
25,920 | public function where ( $ column , $ operator , $ value , $ filter = false ) { return $ this -> constraint ( __FUNCTION__ , $ column , $ operator , $ value , $ filter ) ; } | Adds where clause |
25,921 | public function orWhereEquals ( $ column , $ value , $ filter = false ) { return $ this -> orWhere ( $ column , '=' , $ value , $ filter ) ; } | Appends OR WHERE expression with equality operator |
25,922 | public function orWhereNotEquals ( $ column , $ value , $ filter = false ) { return $ this -> orWhere ( $ column , '!=' , $ value , $ filter ) ; } | Appends OR WHERE with ! = operator |
25,923 | public function orWhereGreaterThanOrEquals ( $ column , $ value , $ filter = false ) { return $ this -> orWhere ( $ column , '>=' , $ value , $ filter ) ; } | Appends OR WHERE with > = operator |
25,924 | public function orWhereLessThanOrEquals ( $ column , $ value , $ filter = false ) { return $ this -> orWhere ( $ column , '<=' , $ value , $ filter ) ; } | Appends OR WHERE with < = operator |
25,925 | public function whereGreaterThan ( $ column , $ value , $ filter = false ) { return $ this -> where ( $ column , '>' , $ value , $ filter ) ; } | Appends WHERE clause with > operator |
25,926 | public function andWhereGreaterThan ( $ column , $ value , $ filter = false ) { return $ this -> andWhere ( $ column , '>' , $ value , $ filter ) ; } | Appends AND WHERE clause with > operator |
25,927 | public function andWhereLessThan ( $ column , $ value , $ filter = false ) { return $ this -> andWhere ( $ column , '<' , $ value , $ filter ) ; } | Appends AND WHERE clause with < operator |
25,928 | public function whereLessThan ( $ column , $ value , $ filter = false ) { return $ this -> where ( $ column , '<' , $ value , $ filter ) ; } | Appends WHERE clause with < operator |
25,929 | public function orWhereLessThan ( $ column , $ value , $ filter = false ) { return $ this -> orWhere ( $ column , '<' , $ value , $ filter ) ; } | Appends WHERE clause with less than operator |
25,930 | public function orWhereGreaterThan ( $ column , $ value , $ filter = false ) { return $ this -> orWhere ( $ column , '>' , $ value , $ filter ) ; } | Appends OR WHERE clause with greater than operator |
25,931 | public function andWhereLike ( $ column , $ value , $ filter = false ) { return $ this -> andWhere ( $ column , 'LIKE' , $ value , $ filter ) ; } | Appends WHERE with like operator |
25,932 | public function andWhereNotLike ( $ column , $ value , $ filter = false ) { return $ this -> andWhere ( $ column , 'NOT LIKE' , $ value , $ filter ) ; } | Appends WHERE with NOT LIKE operator |
25,933 | public function orWhereLike ( $ column , $ value , $ filter = false ) { return $ this -> orWhere ( $ column , 'LIKE' , $ value , $ filter ) ; } | Appends OR WHERE LIKE condition |
25,934 | public function orWhereNotLike ( $ column , $ value , $ filter = false ) { return $ this -> orWhere ( $ column , 'NOT LIKE' , $ value , $ filter ) ; } | Appends OR WHERE NOT LIKE condition |
25,935 | public function whereLike ( $ column , $ value , $ filter = false ) { return $ this -> where ( $ column , 'LIKE' , $ value , $ filter ) ; } | Appends WHERE LIKE condition |
25,936 | public function andWhereEquals ( $ column , $ value , $ filter = false ) { return $ this -> andWhere ( $ column , '=' , $ value , $ filter ) ; } | Appends AND for where clause with equality operator |
25,937 | public function andWhereNotEquals ( $ column , $ value , $ filter = false ) { return $ this -> andWhere ( $ column , '!=' , $ value , $ filter ) ; } | Appends AND WHERE clause with equality operator |
25,938 | public function andWhereEqualsOrGreaterThan ( $ column , $ value , $ filter = false ) { return $ this -> andWhere ( $ column , '>=' , $ value , $ filter ) ; } | Appends AND WHERE with > = operator |
25,939 | public function andWhereEqualsOrLessThan ( $ column , $ value , $ filter = false ) { return $ this -> andWhere ( $ column , '<=' , $ value , $ filter ) ; } | Appends AND WHERE with < = operator |
25,940 | public function dropTable ( $ table , $ ifExists = true ) { $ this -> queryBuilder -> dropTable ( $ table , $ ifExists ) ; return $ this ; } | Appends DROP TABLE statement |
25,941 | public function CommentStore ( $ data , $ form ) { if ( ! isset ( $ data [ 'Extra' ] ) || $ data [ 'Extra' ] == '' || isset ( $ data [ 'nsas' ] ) ) { $ data [ 'Comment' ] = Convert :: raw2sql ( $ data [ 'Comment' ] ) ; $ exists = Comment :: get ( ) -> filter ( array ( 'Comment:PartialMatch' => $ data [ 'Comment' ] ) ) -> where ( 'ABS(TIMEDIFF(NOW(), Created)) < 60' ) ; if ( ! $ exists -> count ( ) ) { $ comment = Comment :: create ( ) ; $ form -> saveInto ( $ comment ) ; $ comment -> NewsID = $ data [ 'NewsID' ] ; $ comment -> write ( ) ; } } Controller :: curr ( ) -> redirectBack ( ) ; } | Store it . And also check if it s no double - post . Limited to 60 seconds but it can be differed . I wonder if this is XSS safe? The saveInto does this for me right? |
25,942 | private static function flattenArgument ( & $ value , $ key ) { if ( $ value instanceof Closure ) { $ closureReflection = new ReflectionFunction ( $ value ) ; $ value = sprintf ( '(Closure at %s:%s)' , $ closureReflection -> getFileName ( ) , $ closureReflection -> getStartLine ( ) ) ; } elseif ( is_object ( $ value ) ) { $ value = sprintf ( 'object(%s)' , get_class ( $ value ) ) ; } elseif ( is_resource ( $ value ) ) { $ value = sprintf ( 'resource(%s)' , get_resource_type ( $ value ) ) ; } } | Limpia de Clousures un argumento para que pueda ser serializable |
25,943 | public static function dynamic ( $ type , $ name , $ value , array $ attributes = array ( ) , $ extra = array ( ) ) { switch ( $ type ) { case 'text' : return self :: text ( $ name , $ value , $ attributes ) ; case 'password' : return self :: password ( $ name , $ value , $ attributes ) ; case 'url' : return self :: url ( $ name , $ value , $ attributes ) ; case 'range' : return self :: range ( $ name , $ value , $ attributes ) ; case 'number' : return self :: number ( $ name , $ value , $ attributes ) ; case 'hidden' : return self :: hidden ( $ name , $ value , $ attributes ) ; case 'date' : return self :: date ( $ name , $ value , $ attributes ) ; case 'time' : return self :: time ( $ name , $ value , $ attributes ) ; case 'color' : return self :: color ( $ name , $ value , $ attributes ) ; case 'textarea' : return self :: textarea ( $ name , $ value , $ attributes ) ; case 'radio' : return self :: radio ( $ name , $ value , ( bool ) $ value , $ attributes ) ; case 'checkbox' : return self :: checkbox ( $ name , $ value , $ attributes , false ) ; case 'select' : return self :: select ( $ name , $ extra , $ value , $ attributes ) ; default : throw new UnexpectedValueException ( sprintf ( 'Unexpected value supplied %s' , $ type ) ) ; } } | Creates dynamic input element |
25,944 | public static function icon ( $ icon , $ link , array $ attributes = array ( ) ) { $ text = sprintf ( '<i class="%s"></i> ' , $ icon ) ; return self :: link ( $ text , $ link , $ attributes ) ; } | Creates a link with inner icon |
25,945 | public static function link ( $ text , $ link = '#' , array $ attributes = array ( ) ) { if ( ! is_null ( $ link ) ) { $ attributes [ 'href' ] = $ link ; } $ node = new Node \ Link ( $ text ) ; return $ node -> render ( $ attributes ) ; } | Creates link element |
25,946 | public static function option ( $ value , $ text , array $ attributes = array ( ) ) { if ( ! is_null ( $ value ) ) { $ attributes [ 'value' ] = $ value ; } $ node = new Node \ Option ( $ text ) ; return $ node -> render ( $ attributes ) ; } | Creates standalone option element |
25,947 | public static function button ( $ text , array $ attributes = array ( ) ) { $ node = new Node \ Button ( $ text ) ; return $ node -> render ( $ attributes ) ; } | Creates button element |
25,948 | public static function radio ( $ name , $ value , $ checked , array $ attributes = array ( ) ) { if ( ! is_null ( $ name ) ) { $ attributes [ 'name' ] = $ name ; } if ( ! is_null ( $ value ) ) { $ attributes [ 'value' ] = $ value ; } $ node = new Node \ Radio ( $ checked ) ; return $ node -> render ( $ attributes ) ; } | Creates Radio node element |
25,949 | public static function checkbox ( $ name , $ checked , array $ attributes = array ( ) , $ serialize = true ) { if ( $ name !== null ) { $ attributes [ 'name' ] = $ name ; } $ node = new Node \ Checkbox ( $ serialize , $ checked ) ; return $ node -> render ( $ attributes ) ; } | Creates Checkbox node element |
25,950 | public static function file ( $ name , $ accept = null , array $ attributes = array ( ) ) { if ( ! is_null ( $ name ) ) { $ attributes [ 'name' ] = $ name ; } if ( ! is_null ( $ accept ) ) { $ attributes [ 'accept' ] = $ accept ; } $ node = new Node \ File ( ) ; return $ node -> render ( $ attributes ) ; } | Creates File node element |
25,951 | public static function select ( $ name , array $ list = array ( ) , $ selected , array $ attributes = array ( ) , $ prompt = false , Closure $ optionVisitor = null ) { if ( $ prompt !== false ) { $ list = array ( '' => $ prompt ) + $ list ; } $ node = new Node \ Select ( $ list , $ selected , array ( ) , $ optionVisitor ) ; if ( $ name !== null ) { $ attributes [ 'name' ] = $ name ; } return $ node -> render ( $ attributes ) ; } | Creates Select element with its child Option nodes |
25,952 | public static function textarea ( $ name , $ text , array $ attributes = array ( ) ) { if ( $ name !== null ) { $ attributes [ 'name' ] = $ name ; } $ node = new Node \ Textarea ( $ text ) ; return $ node -> render ( $ attributes ) ; } | Creates textarea element |
25,953 | public static function text ( $ name , $ value , array $ attributes = array ( ) ) { $ node = new Node \ Text ( ) ; if ( ! is_null ( $ name ) ) { $ attributes [ 'name' ] = $ name ; } if ( ! is_null ( $ value ) ) { $ attributes [ 'value' ] = $ value ; } return $ node -> render ( $ attributes ) ; } | Creates text input element |
25,954 | public static function color ( $ name , $ value , array $ attributes = array ( ) ) { $ node = new Node \ Color ( ) ; if ( ! is_null ( $ name ) ) { $ attributes [ 'name' ] = $ name ; } if ( ! is_null ( $ value ) ) { $ attributes [ 'value' ] = $ value ; } return $ node -> render ( $ attributes ) ; } | Creates color input element |
25,955 | public static function email ( $ name , $ value , array $ attributes = array ( ) ) { $ node = new Node \ Email ( ) ; if ( ! is_null ( $ name ) ) { $ attributes [ 'name' ] = $ name ; } if ( ! is_null ( $ value ) ) { $ attributes [ 'value' ] = $ value ; } return $ node -> render ( $ attributes ) ; } | Creates email input element |
25,956 | public static function hidden ( $ name , $ value , array $ attributes = array ( ) ) { $ node = new Node \ Hidden ( ) ; if ( ! is_null ( $ name ) ) { $ attributes [ 'name' ] = $ name ; } if ( ! is_null ( $ value ) ) { $ attributes [ 'value' ] = $ value ; } return $ node -> render ( $ attributes ) ; } | Creates hidden input element |
25,957 | public static function number ( $ name , $ value , array $ attributes = array ( ) ) { $ node = new Node \ Number ( ) ; if ( ! is_null ( $ name ) ) { $ attributes [ 'name' ] = $ name ; } if ( ! is_null ( $ value ) ) { $ attributes [ 'value' ] = $ value ; } return $ node -> render ( $ attributes ) ; } | Creates number input element |
25,958 | public static function range ( $ name , $ value , array $ attributes = array ( ) ) { $ node = new Node \ Range ( ) ; if ( ! is_null ( $ name ) ) { $ attributes [ 'name' ] = $ name ; } if ( ! is_null ( $ value ) ) { $ attributes [ 'value' ] = $ value ; } return $ node -> render ( $ attributes ) ; } | Creates range input element |
25,959 | public static function url ( $ name , $ value , array $ attributes = array ( ) ) { $ node = new Node \ Url ( ) ; if ( ! is_null ( $ name ) ) { $ attributes [ 'name' ] = $ name ; } if ( ! is_null ( $ value ) ) { $ attributes [ 'value' ] = $ value ; } return $ node -> render ( $ attributes ) ; } | Creates URL input element |
25,960 | public static function password ( $ name , $ value , array $ attributes = array ( ) ) { $ node = new Node \ Password ( ) ; if ( ! is_null ( $ name ) ) { $ attributes [ 'name' ] = $ name ; } if ( ! is_null ( $ value ) ) { $ attributes [ 'value' ] = $ value ; } return $ node -> render ( $ attributes ) ; } | Creates password input element |
25,961 | public static function object ( $ width , $ height , $ data ) { $ node = new Node \ Object ( ) ; $ attributes = array ( 'width' => $ width , 'height' => $ height , 'data' => $ data ) ; return $ node -> render ( $ attributes ) ; } | Renders object element |
25,962 | public static function audio ( $ src , array $ attrs = array ( ) , $ error = null ) { $ node = new Node \ Audio ( $ src , $ error ) ; return $ node -> render ( $ attrs ) ; } | Renders audio element |
25,963 | public static function video ( $ src , array $ attrs = array ( ) , $ error = null ) { $ node = new Node \ Video ( $ src , $ error ) ; return $ node -> render ( $ attrs ) ; } | Renders video element |
25,964 | public function publicValue ( ) : array { $ public = parent :: publicValue ( ) ; array_walk_recursive ( $ public , function ( & $ value ) { if ( $ value instanceof ObjectID ) { $ value = ( string ) $ value ; } } ) ; return $ public ; } | Since most of ODM documents might contain ObjectIDs and other fields we will try to normalize them into string values . |
25,965 | protected function runSilentCommand ( TaskInterface $ task ) { return $ task -> printOutput ( false ) -> setVerbosityThreshold ( VerbosityThresholdInterface :: VERBOSITY_DEBUG ) -> run ( ) ; } | Run silent command . |
25,966 | private function createDefaultOptionNodes ( ) { $ nodes = array ( ) ; foreach ( $ this -> defaults as $ key => $ value ) { if ( is_scalar ( $ value ) ) { array_push ( $ nodes , $ this -> createOptionNode ( $ key , $ value ) ) ; } } return $ nodes ; } | Creates default option node |
25,967 | private function isActiveNode ( $ value ) { if ( is_array ( $ this -> active ) ) { $ actives = array_values ( $ this -> active ) ; return in_array ( $ value , $ actives ) ; } else { if ( $ this -> active === '*' ) { return true ; } return ( string ) $ this -> active == ( string ) $ value ; } } | Determines whether node is active |
25,968 | private function createOptionNode ( $ value , $ text ) { $ option = new NodeElement ( ) ; $ option -> openTag ( 'option' ) -> addAttribute ( 'value' , $ value ) ; if ( $ this -> isActiveNode ( $ value ) ) { $ option -> addProperty ( 'selected' ) ; } if ( $ this -> optionVisitor instanceof Closure ) { $ result = call_user_func ( $ this -> optionVisitor , $ value , $ text ) ; if ( is_array ( $ result ) ) { $ option -> addAttributes ( $ result ) ; } else { throw new UnexpectedValueException ( sprintf ( 'The visitor must return associative array with attribute names and their corresponding values. Received - "%s"' , gettype ( $ result ) ) ) ; } } $ option -> finalize ( ) -> setText ( $ text ) -> closeTag ( ) ; return $ option ; } | Creates option node |
25,969 | private function createOptgroupNode ( $ label , array $ list ) { $ optgroup = new NodeElement ( ) ; $ optgroup -> openTag ( 'optgroup' ) -> addAttribute ( 'label' , $ label ) -> finalize ( ) ; foreach ( $ this -> getOptions ( $ list ) as $ option ) { $ optgroup -> appendChild ( $ option ) ; } $ optgroup -> closeTag ( ) ; return $ optgroup ; } | Creates optgroup node with nested options |
25,970 | private function getOptions ( array $ list ) { $ elements = array ( ) ; foreach ( $ list as $ value => $ text ) { array_push ( $ elements , $ this -> createOptionNode ( $ value , $ text ) ) ; } return $ elements ; } | Returns a collection of prepared option elements |
25,971 | protected function formatIndex ( $ name ) { if ( \ is_string ( $ name ) ) { $ exp = explode ( '.' , $ name ) ; if ( 0 < \ count ( $ exp ) ) { $ name = $ exp [ \ count ( $ exp ) - 1 ] ; } } return $ name ; } | Format the index without prefix with dot . |
25,972 | protected function getDataField ( $ dataRow , $ name , \ Closure $ emptyData = null ) { $ value = null !== $ name && '' !== $ name ? $ this -> propertyAccessor -> getValue ( $ dataRow , $ name ) : null ; if ( null === $ value && $ emptyData instanceof \ Closure ) { $ value = $ emptyData ( $ dataRow , $ name ) ; } return $ value ; } | Get the field value of data row . |
25,973 | protected function overrideCellOptions ( BlockInterface $ column , $ formatter , $ data , array $ options ) { $ config = $ column -> getConfig ( ) ; if ( $ config -> hasOption ( 'override_options' ) && ( $ override = $ config -> getOption ( 'override_options' ) ) instanceof \ Closure ) { $ options = $ override ( $ options , $ data , $ formatter ) ; } return $ options ; } | Override the formatter options . |
25,974 | protected function doPreGetData ( ) { foreach ( $ this -> dataTransformers as $ dataTransformer ) { if ( $ dataTransformer instanceof PreGetDataTransformerInterface ) { $ dataTransformer -> preGetData ( $ this -> config ) ; } } } | Action before getting the data . |
25,975 | protected function doPostGetData ( ) { foreach ( $ this -> dataTransformers as $ dataTransformer ) { if ( $ dataTransformer instanceof PostGetDataTransformerInterface ) { $ dataTransformer -> postGetData ( $ this -> config ) ; } } } | Action after getting the data . |
25,976 | public function registerDefaultEncoders ( EncoderRegistry $ encoders ) : EncoderRegistry { $ encoders -> registerDefaultObjectEncoder ( new ObjectEncoder ( $ encoders , $ this -> propertyNameFormatter ) ) ; $ encoders -> registerDefaultScalarEncoder ( new ScalarEncoder ( ) ) ; $ encoders -> registerEncoder ( 'array' , new ArrayEncoder ( $ encoders ) ) ; $ dateTimeEncoder = new DateTimeEncoder ( $ this -> dateTimeFormat ) ; $ encoders -> registerEncoder ( DateTime :: class , $ dateTimeEncoder ) ; $ encoders -> registerEncoder ( DateTimeImmutable :: class , $ dateTimeEncoder ) ; $ encoders -> registerEncoder ( DateTimeInterface :: class , $ dateTimeEncoder ) ; return $ encoders ; } | Registers the default encoders |
25,977 | public function exportDrupalConfig ( ) { $ version = $ this -> getProjectVersion ( ) ; if ( $ version >= 8 ) { $ this -> runDrushCommand ( 'cex' ) ; $ this -> saveDrupalUuid ( ) ; } return $ this ; } | Export Drupal configuration . |
25,978 | public function importDrupalConfig ( $ reimport_attempts = 1 , $ localhost = false ) { if ( $ this -> getProjectVersion ( ) >= 8 ) { try { $ drush = ( new DrushCommand ( null , $ localhost ) ) -> command ( 'cr' ) -> command ( 'cim' ) ; $ this -> runDrushCommand ( $ drush , false , $ localhost ) ; } catch ( TaskResultRuntimeException $ exception ) { if ( $ reimport_attempts < 1 ) { throw $ exception ; } $ errors = 0 ; $ result = null ; for ( $ i = 0 ; $ i < $ reimport_attempts ; $ i ++ ) { $ result = $ this -> runDrushCommand ( 'cim' , false , $ localhost ) ; if ( $ result -> getExitCode ( ) === ResultData :: EXITCODE_OK ) { break ; } ++ $ errors ; } if ( ! isset ( $ result ) ) { throw new \ Exception ( 'Missing result object.' ) ; } else if ( $ errors == $ reimport_attempts ) { throw new TaskResultRuntimeException ( $ result ) ; } } } return $ this ; } | Drupal import configurations . |
25,979 | public function optionForm ( ) { $ fields = [ ] ; $ default = $ this -> defaultInstallOptions ( ) ; $ fields [ ] = ( new BooleanField ( 'site' , 'Setup Drupal site options?' ) ) -> setDefault ( false ) -> setSubform ( function ( $ subform , $ value ) use ( $ default ) { if ( $ value === true ) { $ subform -> addFields ( [ ( new TextField ( 'name' , 'Drupal site name?' ) ) -> setDefault ( $ default [ 'site' ] [ 'name' ] ) , ( new TextField ( 'profile' , 'Drupal site profile?' ) ) -> setDefault ( $ default [ 'site' ] [ 'profile' ] ) , ] ) ; } } ) ; $ fields [ ] = ( new BooleanField ( 'account' , 'Setup Drupal account options?' ) ) -> setDefault ( false ) -> setSubform ( function ( $ subform , $ value ) use ( $ default ) { if ( $ value === true ) { $ subform -> addFields ( [ ( new TextField ( 'mail' , 'Account email:' ) ) -> setDefault ( $ default [ 'account' ] [ 'mail' ] ) , ( new TextField ( 'name' , 'Account username:' ) ) -> setDefault ( $ default [ 'account' ] [ 'name' ] ) , ( new TextField ( 'pass' , 'Account password:' ) ) -> setHidden ( true ) -> setDefault ( $ default [ 'account' ] [ 'pass' ] ) , ] ) ; } } ) ; return ( new Form ( ) ) -> addFields ( $ fields ) ; } | Drupal option form object . |
25,980 | public function setupProject ( ) { $ this -> taskWriteToFile ( ProjectX :: projectRoot ( ) . '/.gitignore' ) -> text ( $ this -> loadTemplateContents ( '.gitignore.txt' ) ) -> place ( 'PROJECT_ROOT' , $ this -> getInstallRoot ( true ) ) -> run ( ) ; return $ this ; } | Setup project . |
25,981 | public function setupProjectComposer ( ) { $ this -> mergeProjectComposerTemplate ( ) ; $ install_root = substr ( static :: installRoot ( ) , 1 ) ; $ version = $ this -> getProjectVersion ( ) ; $ this -> composer -> setType ( 'project' ) -> setPreferStable ( true ) -> setMinimumStability ( 'dev' ) -> setConfig ( [ 'platform' => [ 'php' => "{$this->getEnvPhpVersion()}" ] ] ) -> addRepository ( 'drupal' , [ 'type' => 'composer' , 'url' => "https://packages.drupal.org/{$version}" ] ) -> addRequires ( [ 'drupal/core' => static :: DRUPAL_8_VERSION , 'composer/installers' => '^1.1' , 'cweagans/composer-patches' => '^1.5' , 'drupal-composer/drupal-scaffold' => '^2.0' ] ) -> addExtra ( 'drupal-scaffold' , [ 'excludes' => [ 'robot.txt' ] , 'initial' => [ 'sites/development.services.yml' => 'sites/development.services.yml' , 'sites/example.settings.local.php' => 'sites/example.settings.local.php' ] , 'omit-defaults' => false ] ) -> addExtra ( 'installer-paths' , [ $ install_root . '/core' => [ 'type:drupal-core' ] , $ install_root . '/modules/contrib/{$name}' => [ 'type:drupal-module' ] , $ install_root . '/profiles/custom/{$name}' => [ 'type:drupal-profile' ] , $ install_root . '/themes/contrib/{$name}' => [ 'type:drupal-theme' ] , 'drush/contrib/{$name}' => [ 'type:drupal-drush' ] ] ) ; return $ this ; } | Setup project composer requirements . |
25,982 | public function packageDrupalBuild ( $ build_root ) { $ project_root = ProjectX :: projectRoot ( ) ; $ build_install = $ build_root . static :: installRoot ( ) ; $ install_path = $ this -> getInstallPath ( ) ; $ stack = $ this -> taskFilesystemStack ( ) ; $ static_files = [ "{$project_root}/salt.txt" => "{$build_root}/salt.txt" , "{$install_path}/.htaccess" => "{$build_install}/.htaccess" , "{$install_path}/index.php" => "{$build_install}/index.php" , "{$install_path}/robots.txt" => "{$build_install}/robots.txt" , "{$install_path}/update.php" => "{$build_install}/update.php" , "{$install_path}/web.config" => "{$build_install}/web.config" , "{$install_path}/sites/default/settings.php" => "{$build_install}/sites/default/settings.php" , ] ; foreach ( $ static_files as $ source => $ destination ) { if ( ! file_exists ( $ source ) ) { continue ; } $ stack -> copy ( $ source , $ destination ) ; } $ mirror_directories = [ '/config' , static :: installRoot ( ) . '/libraries' , static :: installRoot ( ) . '/themes/custom' , static :: installRoot ( ) . '/modules/custom' , static :: installRoot ( ) . '/profiles/custom' ] ; foreach ( $ mirror_directories as $ directory ) { $ path_to_directory = "{$project_root}{$directory}" ; if ( ! file_exists ( $ path_to_directory ) ) { continue ; } $ stack -> mirror ( $ path_to_directory , "{$build_root}{$directory}" ) ; } $ stack -> run ( ) ; return $ this ; } | Package up Drupal into a build directory . |
25,983 | public function setupDrush ( $ exclude_remote = false ) { $ project_root = ProjectX :: projectRoot ( ) ; $ this -> taskFilesystemStack ( ) -> mirror ( $ this -> getTemplateFilePath ( 'drush' ) , "$project_root/drush" ) -> copy ( $ this -> getTemplateFilePath ( 'drush.wrapper' ) , "$project_root/drush.wrapper" ) -> run ( ) ; $ this -> taskWriteToFile ( "{$project_root}/drush/drushrc.php" ) -> append ( ) -> place ( 'PROJECT_ROOT' , $ this -> getInstallRoot ( true ) ) -> run ( ) ; $ this -> setupDrushAlias ( $ exclude_remote ) ; return $ this ; } | Setup Drupal drush . |
25,984 | public function setupDrushAlias ( $ exclude_remote = false ) { $ project_root = ProjectX :: projectRoot ( ) ; if ( ! file_exists ( "$project_root/drush/site-aliases" ) ) { $ continue = $ this -> askConfirmQuestion ( "Drush aliases haven't been setup for this project.\n" . "\nDo you want run the Drush alias setup?" , true ) ; if ( ! $ continue ) { return $ this ; } $ this -> setupDrush ( $ exclude_remote ) ; } else { $ this -> setupDrushLocalAlias ( ) ; if ( ! $ exclude_remote ) { $ this -> setupDrushRemoteAliases ( ) ; } } return $ this ; } | Setup Drush aliases . |
25,985 | public function setupDrushLocalAlias ( $ alias_name = null ) { $ config = ProjectX :: getProjectConfig ( ) ; $ alias_name = isset ( $ alias_name ) ? Utiltiy :: machineName ( $ alias_name ) : ProjectX :: getProjectMachineName ( ) ; $ alias_content = $ this -> drushAliasFileContent ( $ alias_name , $ config -> getHost ( ) [ 'name' ] , $ this -> getInstallPath ( ) ) ; $ project_root = ProjectX :: projectRoot ( ) ; $ this -> taskWriteToFile ( "$project_root/drush/site-aliases/local.aliases.drushrc.php" ) -> line ( $ alias_content ) -> run ( ) ; return $ this ; } | Setup Drupal local alias . |
25,986 | public function setupDrushRemoteAliases ( ) { $ project_root = ProjectX :: projectRoot ( ) ; $ drush_aliases_dir = "$project_root/drush/site-aliases" ; foreach ( ProjectX :: getRemoteEnvironments ( ) as $ realm => $ environment ) { $ file_task = $ this -> taskWriteToFile ( "$drush_aliases_dir/$realm.aliases.drushrc.php" ) ; $ has_content = false ; for ( $ i = 0 ; $ i < count ( $ environment ) ; $ i ++ ) { $ instance = $ environment [ $ i ] ; if ( ! isset ( $ instance [ 'name' ] ) || ! isset ( $ instance [ 'path' ] ) || ! isset ( $ instance [ 'uri' ] ) || ! isset ( $ instance [ 'ssh_url' ] ) ) { continue ; } list ( $ ssh_user , $ ssh_host ) = explode ( '@' , $ instance [ 'ssh_url' ] ) ; $ options = [ 'remote_user' => $ ssh_user , 'remote_host' => $ ssh_host ] ; $ content = $ this -> drushAliasFileContent ( $ instance [ 'name' ] , $ instance [ 'uri' ] , $ instance [ 'path' ] , $ options , $ i === 0 ) ; $ has_content = true ; $ file_task -> line ( $ content ) ; } if ( $ has_content ) { $ file_task -> run ( ) ; } } return $ this ; } | Setup Drush remote aliases . |
25,987 | public function createDrupalLoginLink ( $ user = null , $ path = null , $ localhost = false ) { $ arg = [ ] ; if ( isset ( $ user ) ) { $ arg [ ] = $ user ; } if ( isset ( $ path ) ) { $ arg [ ] = $ path ; } $ args = implode ( ' ' , $ arg ) ; $ drush = ( new DrushCommand ( null , $ localhost ) ) -> command ( "uli {$args}" ) ; $ this -> runDrushCommand ( $ drush , false , $ localhost ) ; return $ this ; } | Create a Drupal login link . |
25,988 | public function setupDrupalFilesystem ( ) { $ this -> taskFilesystemStack ( ) -> chmod ( $ this -> sitesPath , 0775 , 0000 , true ) -> mkdir ( "{$this->sitesPath}/default/files" , 0775 , true ) -> run ( ) ; if ( $ this -> getProjectVersion ( ) >= 8 ) { $ install_path = $ this -> getInstallPath ( ) ; $ this -> taskFilesystemStack ( ) -> mkdir ( "{$install_path}/profiles/custom" , 0775 , true ) -> mkdir ( "{$install_path}/modules/custom" , 0775 , true ) -> mkdir ( "{$install_path}/modules/contrib" , 0775 , true ) -> run ( ) ; } return $ this ; } | Setup Drupal filesystem . |
25,989 | public function setupDrupalSettings ( ) { $ this -> _copy ( "{$this->sitesPath}/default/default.settings.php" , $ this -> settingFile ) ; $ install_root = dirname ( $ this -> getQualifiedInstallRoot ( ) ) ; if ( $ this -> getProjectVersion ( ) >= 8 ) { $ this -> taskWriteToFile ( "{$install_root}/salt.txt" ) -> line ( Utility :: randomHash ( ) ) -> run ( ) ; $ this -> taskFilesystemStack ( ) -> mkdir ( "{$install_root}/config" , 0775 ) -> chmod ( "{$install_root}/salt.txt" , 0775 ) -> run ( ) ; $ this -> taskWriteToFile ( $ this -> settingFile ) -> append ( ) -> regexReplace ( '/\#\sif.+\/settings\.local\.php.+\n#.+\n\#\s}/' , $ this -> drupalSettingsLocalInclude ( ) ) -> replace ( '$config_directories = array();' , '$config_directories[CONFIG_SYNC_DIRECTORY] = dirname(DRUPAL_ROOT) . \'/config\';' ) -> replace ( '$settings[\'hash_salt\'] = \'\';' , '$settings[\'hash_salt\'] = file_get_contents(dirname(DRUPAL_ROOT) . \'/salt.txt\');' ) -> run ( ) ; } return $ this ; } | Setup Drupal settings file . |
25,990 | public function setupDrupalLocalSettings ( ) { $ version = $ this -> getProjectVersion ( ) ; $ local_settings = $ this -> templateManager ( ) -> loadTemplate ( "{$version}/settings.local.txt" ) ; $ this -> _remove ( $ this -> settingLocalFile ) ; if ( $ version >= 8 ) { $ setting_path = "{$this->sitesPath}/example.settings.local.php" ; if ( file_exists ( $ setting_path ) ) { $ this -> _copy ( $ setting_path , $ this -> settingLocalFile ) ; } else { $ this -> taskWriteToFile ( $ this -> settingLocalFile ) -> text ( "<?php\r\n" ) -> run ( ) ; } } else { $ this -> taskWriteToFile ( $ this -> settingLocalFile ) -> text ( "<?php\r\n" ) -> run ( ) ; } $ database = $ this -> getDatabaseInfo ( ) ; $ this -> taskWriteToFile ( $ this -> settingLocalFile ) -> append ( ) -> appendUnlessMatches ( '/\$databases\[.+\]/' , $ local_settings ) -> place ( 'DB_NAME' , $ database -> getDatabase ( ) ) -> place ( 'DB_USER' , $ database -> getUser ( ) ) -> place ( 'DB_PASS' , $ database -> getPassword ( ) ) -> place ( 'DB_HOST' , $ database -> getHostname ( ) ) -> place ( 'DB_PORT' , $ database -> getPort ( ) ) -> place ( 'DB_PROTOCOL' , $ database -> getProtocol ( ) ) -> run ( ) ; return $ this ; } | Setup Drupal local settings file . |
25,991 | public function setupDrupalInstall ( $ localhost = false ) { $ this -> say ( 'Waiting on Drupal database to become available...' ) ; $ database = $ this -> getDatabaseInfo ( ) ; $ engine = $ this -> getEngineInstance ( ) ; $ install_path = $ this -> getInstallPath ( ) ; if ( $ engine instanceof DockerEngineType && ! $ localhost ) { $ drush = $ this -> drushInstallCommonStack ( '/var/www/html/vendor/bin/drush' , '/var/www/html' . static :: installRoot ( ) , $ database ) ; $ result = $ engine -> execRaw ( $ drush -> getCommand ( ) , $ this -> getPhpServiceName ( ) ) ; } else { $ database -> setHostname ( '127.0.0.1' ) ; if ( ! $ this -> hasDatabaseConnection ( $ database -> getHostname ( ) , $ database -> getPort ( ) ) ) { throw new \ Exception ( sprintf ( 'Unable to connection to Drupal database %s' , $ database -> getHostname ( ) ) ) ; } sleep ( 30 ) ; $ result = $ this -> drushInstallCommonStack ( 'drush' , $ install_path , $ database ) -> run ( ) ; } $ this -> validateTaskResult ( $ result ) ; $ this -> _chmod ( $ install_path , 0775 , 0000 , true ) ; return $ this ; } | Setup Drupal install . |
25,992 | public function removeGitSubmodulesInVendor ( $ base_path = null ) { $ base_path = isset ( $ base_path ) && file_exists ( $ base_path ) ? $ base_path : ProjectX :: projectRoot ( ) ; $ composer = $ this -> getComposer ( ) ; $ composer_config = $ composer -> getConfig ( ) ; $ vendor_dir = isset ( $ composer_config [ 'vendor-dir' ] ) ? $ composer_config [ 'vendor-dir' ] : 'vendor' ; $ this -> removeGitSubmodules ( [ $ base_path . "/{$vendor_dir}" ] , 2 ) ; return $ this ; } | Remove git submodule in vendor . |
25,993 | public function getValidComposerInstallPaths ( $ base_path = null ) { $ filepaths = [ ] ; $ composer = $ this -> getComposer ( ) ; $ composer_extra = $ composer -> getExtra ( ) ; $ base_path = isset ( $ base_path ) && file_exists ( $ base_path ) ? $ base_path : ProjectX :: projectRoot ( ) ; $ installed_paths = isset ( $ composer_extra [ 'installer-paths' ] ) ? array_keys ( $ composer_extra [ 'installer-paths' ] ) : [ ] ; $ installed_directory = substr ( static :: getInstallPath ( ) , strrpos ( static :: getInstallPath ( ) , '/' ) ) ; foreach ( $ installed_paths as $ installed_path ) { $ path_info = pathinfo ( $ installed_path ) ; $ directory = "/{$path_info['dirname']}" ; if ( strpos ( $ directory , $ installed_directory ) === false ) { continue ; } $ filename = $ path_info [ 'filename' ] !== '{$name}' ? "/{$path_info['filename']}" : null ; $ filepath = $ base_path . $ directory . $ filename ; if ( ! file_exists ( $ filepath ) ) { continue ; } $ filepaths [ ] = $ filepath ; } return $ filepaths ; } | Get valid composer install paths . |
25,994 | public function runDrushCommand ( $ command , $ quiet = false , $ localhost = false ) { if ( $ command instanceof CommandBuilder ) { $ drush = $ command ; } else { $ drush = new DrushCommand ( null , $ localhost ) ; foreach ( explode ( '&&' , $ command ) as $ string ) { $ drush -> command ( $ string ) ; } } return $ this -> executeEngineCommand ( $ drush , $ this -> getPhpServiceName ( ) , [ ] , $ quiet , $ localhost ) ; ; } | Run Drush command . |
25,995 | public function setDrupalUuid ( $ localhost = false ) { if ( $ this -> getProjectVersion ( ) >= 8 ) { $ build_info = $ this -> getProjectOptionByKey ( 'build_info' ) ; if ( $ build_info !== false && isset ( $ build_info [ 'uuid' ] ) && ! empty ( $ build_info [ 'uuid' ] ) ) { $ drush = new DrushCommand ( null , $ localhost ) ; $ drush -> command ( "cset system.site uuid {$build_info['uuid']}" ) -> command ( 'ev \'\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();\'' ) ; $ this -> runDrushCommand ( $ drush , false , $ localhost ) ; } } return $ this ; } | Set Drupal UUID . |
25,996 | protected function refreshDatabaseSettings ( ) { $ database = $ this -> getDatabaseInfo ( ) ; $ settings = file_get_contents ( $ this -> settingLocalFile ) ; foreach ( $ database -> asArray ( ) as $ property => $ value ) { $ settings = $ this -> replaceDatabaseProperty ( $ property , $ value , $ settings ) ; } $ namespace_base = addslashes ( 'Drupal\\\\Core\\\\Database\\\\Driver\\\\' ) ; $ settings = $ this -> replaceDatabaseProperty ( 'namespace' , "{$namespace_base}{$database->getProtocol()}" , $ settings ) ; $ status = file_put_contents ( $ this -> settingLocalFile , $ settings ) ; if ( false === $ status ) { throw new \ Exception ( sprintf ( 'Unable to refresh database settings in (%s).' , $ this -> settingLocalFile ) ) ; return false ; } return true ; } | Refresh database settings . |
25,997 | protected function setupDatabaseFromRestore ( $ method = null , $ localhost = false ) { $ engine = $ this -> getEngineInstance ( ) ; if ( $ engine instanceof DockerEngineType ) { $ options = $ this -> databaseRestoreOptions ( ) ; if ( ! isset ( $ method ) || ! in_array ( $ method , $ options ) ) { $ method = $ this -> doAsk ( new ChoiceQuestion ( 'Setup the project using? ' , $ options ) ) ; } switch ( $ method ) { case 'site-config' : $ this -> setupDrupalInstall ( $ localhost ) -> setDrupalUuid ( $ localhost ) -> importDrupalConfig ( 1 , $ localhost ) ; break ; case 'database-import' : $ this -> importDatabaseToService ( $ this -> getPhpServiceName ( ) , null , true , $ localhost ) ; break ; default : $ platform = $ this -> getPlatformInstance ( ) ; if ( $ platform instanceof DrupalPlatformRestoreInterface ) { $ platform -> drupalRestore ( $ method ) ; } } $ this -> clearDrupalCache ( $ localhost ) ; } else { $ classname = get_class ( $ engine ) ; throw new \ RuntimeException ( sprintf ( "The engine type %s isn't supported" , $ classname :: getLabel ( ) ) ) ; } return $ this ; } | Setup a Drupal database from restore . |
25,998 | protected function databaseRestoreOptions ( ) { $ options = [ ] ; if ( $ this -> getProjectVersion ( ) >= 8 && $ this -> hasDrupalConfig ( ) ) { $ options [ ] = 'site-config' ; } $ options [ ] = 'database-import' ; $ platform = $ this -> getPlatformInstance ( ) ; if ( $ platform instanceof DrupalPlatformRestoreInterface ) { $ options = array_merge ( $ options , $ platform -> drupalRestoreOptions ( ) ) ; } return $ options ; } | Drupal database restore options . |
25,999 | protected function hasDatabaseInfoChanged ( ) { $ settings_uri = $ this -> settingLocalFile ; if ( file_exists ( $ settings_uri ) ) { $ settings = file_get_contents ( $ settings_uri ) ; $ match_status = preg_match_all ( "/\'(database|username|password|host|port|driver)\'\s=>\s\'(.+)\'\,?/" , $ settings , $ matches ) ; if ( $ match_status !== false ) { $ database = $ this -> getDatabaseInfo ( ) ; $ database_file = array_combine ( $ matches [ 1 ] , $ matches [ 2 ] ) ; foreach ( $ database -> asArray ( ) as $ property => $ value ) { if ( isset ( $ database_file [ $ property ] ) && $ database_file [ $ property ] != $ value ) { return true ; } } } } return false ; } | Determine if database info has been updated . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.