idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
36,600
public function onReservationKeyReady ( callable $ callback = null ) { if ( $ callback === null || is_callable ( $ callback ) ) { $ this -> on_reservation_key_ready = $ callback ; } else { throw new InvalidArgumentException ( 'Callable or NULL expected' ) ; } }
Callback that is called when reservation key is prepared for a particular job but not yet set .
36,601
private function reserveNextJobs ( array $ from_channels = null , $ number_of_jobs_to_reserve = 1 ) { $ reserved_job_ids = [ ] ; $ timestamp = date ( 'Y-m-d H:i:s' ) ; $ channel_conditions = empty ( $ from_channels ) ? '' : $ this -> connection -> prepareConditions ( [ '`channel` IN ? AND ' , $ from_channels ] ) ; $ limit = $ number_of_jobs_to_reserve + 100 ; $ job_ids = $ this -> connection -> executeFirstColumn ( 'SELECT `id` FROM `' . self :: JOBS_TABLE_NAME . "` WHERE {$channel_conditions}`reserved_at` IS NULL AND `available_at` <= ? ORDER BY `priority` DESC, `id` LIMIT 0, {$limit}" , $ timestamp ) ; if ( ! empty ( $ job_ids ) ) { foreach ( $ job_ids as $ job_id ) { $ reservation_key = $ this -> prepareNewReservationKey ( ) ; if ( $ this -> on_reservation_key_ready ) { call_user_func ( $ this -> on_reservation_key_ready , $ job_id , $ reservation_key ) ; } $ this -> connection -> execute ( 'UPDATE `' . self :: JOBS_TABLE_NAME . '` SET `reservation_key` = ?, `reserved_at` = ? WHERE `id` = ? AND `reservation_key` IS NULL' , $ reservation_key , $ timestamp , $ job_id ) ; if ( $ this -> connection -> affectedRows ( ) === 1 ) { $ reserved_job_ids [ ] = $ job_id ; if ( count ( $ reserved_job_ids ) >= $ number_of_jobs_to_reserve ) { break ; } } } } return $ reserved_job_ids ; }
Reserve next job ID .
36,602
private function jsonDecode ( $ serialized_data ) { $ data = json_decode ( $ serialized_data , true ) ; if ( json_last_error ( ) ) { $ error_message = 'Failed to parse JSON' ; if ( function_exists ( 'json_last_error_msg' ) ) { $ error_message .= '. Reason: ' . json_last_error_msg ( ) ; } throw new RuntimeException ( $ error_message ) ; } return $ data ; }
Decode JSON and throw an exception in case of any error .
36,603
public function getOxcomAdminSearchResults ( ) { $ aData = [ ] ; if ( strlen ( $ this -> _sQueryName ) > 2 ) { if ( $ this -> getOxcomAdminSearchConfigParam ( "blOxComAdminSearchShowArticles" ) ) { $ aData [ "articles" ] = $ this -> _getOxcomAdminSearchArticles ( ) ; } if ( $ this -> getOxcomAdminSearchConfigParam ( "blOxComAdminSearchShowCategories" ) ) { $ aData [ "categories" ] = $ this -> _getOxcomAdminSearchCategories ( ) ; } if ( $ this -> getOxcomAdminSearchConfigParam ( "blOxComAdminSearchShowCmsPages" ) ) { $ aData [ "cmspages" ] = $ this -> _getOxcomAdminSearchCmsPages ( ) ; } if ( $ this -> getOxcomAdminSearchConfigParam ( "blOxComAdminSearchShowOrders" ) ) { $ aData [ "orders" ] = $ this -> _getOxcomAdminSearchOrders ( ) ; } if ( $ this -> getOxcomAdminSearchConfigParam ( "blOxComAdminSearchShowUsers" ) ) { $ aData [ "users" ] = $ this -> _getOxcomAdminSearchUsers ( ) ; } if ( $ this -> getOxcomAdminSearchConfigParam ( "blOxComAdminSearchShowCompanies" ) ) { $ aData [ "companies" ] = $ this -> _getOxcomAdminSearchCompanies ( ) ; } if ( $ this -> getOxcomAdminSearchConfigParam ( "blOxComAdminSearchShowVendors" ) ) { $ aData [ "vendors" ] = $ this -> _getOxcomAdminSearchVendors ( ) ; } if ( $ this -> getOxcomAdminSearchConfigParam ( "blOxComAdminSearchShowManufacturers" ) ) { $ aData [ "manufacturers" ] = $ this -> _getOxcomAdminSearchManufacturers ( ) ; } if ( $ this -> getOxcomAdminSearchConfigParam ( "blOxComAdminSearchShowModules" ) ) { $ aData [ "modules" ] = $ this -> _getOxcomAdminSearchModules ( ) ; } } echo json_encode ( $ aData ) ; exit ; }
Gets search results for template
36,604
protected function _getOxcomAdminSearchArticles ( ) { $ sViewName = $ this -> _sViewNameGenerator -> getViewName ( "oxarticles" ) ; $ sSql = "SELECT oxid, CONCAT(oxtitle, '', oxvarselect, ' (', oxartnum, ')') FROM $sViewName WHERE CONCAT(oxtitle, '', oxvarselect, oxartnum) LIKE " . \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> quote ( '%' . $ this -> _sQueryName . '%' ) ; return $ this -> _getOxcomAdminSearchData ( $ sSql , 'article' ) ; }
Gets search articles data
36,605
protected function _getOxcomAdminSearchModules ( ) { $ aData = [ ] ; $ oModules = oxNew ( \ OxidEsales \ Eshop \ Core \ Module \ ModuleList :: class ) ; $ aModules = $ oModules -> getModulePaths ( ) ; foreach ( $ aModules as $ sKey => $ sValue ) { $ oModule = oxNew ( \ OxidEsales \ Eshop \ Core \ Module \ Module :: class ) ; $ oModule -> load ( $ sKey ) ; $ sTitle = strip_tags ( $ oModule -> getTitle ( ) ) ; if ( strstr ( strtolower ( $ sTitle ) , strtolower ( $ this -> _sQueryName ) ) ) { $ aData [ ] = [ 'name' => $ sTitle . ' (' . ( $ oModule -> isActive ( ) ? Registry :: getLang ( ) -> translateString ( "OXCOM_ADMINSEARCH_MODULE_ACTIVE" ) : Registry :: getLang ( ) -> translateString ( "OXCOM_ADMINSEARCH_MODULE_INACTIVE" ) ) . ')' , 'oxid' => $ sKey , 'type' => 'module' ] ; } } return $ aData ; }
Gets search modules data
36,606
protected function _getOxcomAdminSearchData ( $ sSql = '' , $ sType = '' ) { $ aData = [ ] ; $ oDbRes = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> select ( $ sSql ) ; if ( $ oDbRes != false && $ oDbRes -> count ( ) > 0 ) { while ( ! $ oDbRes -> EOF ) { $ aField = $ oDbRes -> getFields ( ) ; $ aData [ ] = [ 'name' => $ aField [ 1 ] , 'oxid' => $ aField [ 0 ] , 'type' => $ sType ] ; $ oDbRes -> fetchRow ( ) ; } } return $ aData ; }
Gets search result as array
36,607
public function publish ( GenericEvent $ event ) { $ legacyArticle = $ event -> getSubject ( ) ; $ arguments = $ event -> getArguments ( ) ; if ( $ legacyArticle instanceof \ Article ) { $ entry = $ this -> em -> getRepository ( 'Newscoop\IngestPluginBundle\Entity\Feed\Entry' ) -> findOneByArticleId ( $ legacyArticle -> getArticleNumber ( ) ) ; if ( $ entry !== null ) { $ entry -> setPublished ( new \ DateTime ( $ legacyArticle -> getPublishDate ( ) ) ) ; $ this -> em -> persist ( $ entry ) ; $ this -> em -> flush ( ) ; } } }
Handles publish and published event for articles . Will update entry published date with article published date .
36,608
public function delete ( GenericEvent $ event ) { $ eventCaller = $ event -> getSubject ( ) ; $ arguments = $ event -> getArguments ( ) ; if ( $ eventCaller instanceof \ Article ) { $ entry = $ this -> em -> getRepository ( 'Newscoop\IngestPluginBundle\Entity\Feed\Entry' ) -> findOneByArticleId ( $ eventCaller -> getArticleNumber ( ) ) ; if ( $ entry !== null ) { $ entry -> setArticleId ( NULL ) ; $ entry -> setPublished ( NULL ) ; $ this -> em -> persist ( $ entry ) ; $ this -> em -> flush ( ) ; } } }
Handles delete event for articles . Unlink article from entry and unpublishes entry .
36,609
public function renderException ( $ e , $ output ) { if ( isset ( $ this -> exceptionHandler ) ) { $ this -> exceptionHandler -> handleConsole ( $ e ) ; } parent :: renderException ( $ e , $ output ) ; }
Render the given exception .
36,610
static public function start ( $ flags = 0 , $ options = array ( ) ) { if ( ! extension_loaded ( 'xhprof' ) ) { eZPerfLoggerDebug :: writeWarning ( 'Extension xhprof not loaded, can not start profiling' , __METHOD__ ) ; return false ; } xhprof_enable ( $ flags + XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY , $ options ) ; self :: $ profilingRunning = true ; return true ; }
Starts XHPRof profiling
36,611
static public function savedRuns ( $ offset = 0 , $ limit = 0 ) { $ runsList = array ( ) ; $ count = 0 ; if ( ! is_dir ( self :: logDir ( ) ) ) { return array ( $ runsList , $ count ) ; } foreach ( scandir ( self :: logDir ( ) , 1 ) as $ file ) { $ fullfile = self :: logDir ( ) . "/" . $ file ; if ( is_file ( $ fullfile ) && substr ( $ file , - 7 ) == '.xhprof' ) { $ count ++ ; if ( $ count >= $ offset && ( $ limit <= 0 || count ( $ runsList ) <= $ limit ) ) { $ run = substr ( $ file , 0 , - 7 ) ; $ runsList [ $ run ] = array ( 'time' => filemtime ( $ fullfile ) ) ; if ( is_file ( $ infoFile = self :: logDir ( ) . "/$run.info" ) ) { if ( is_array ( $ info = eZPerfLoggerApacheLogger :: parseLogLine ( file_get_contents ( $ infoFile ) ) ) ) { $ runsList [ $ run ] = $ info ; } } } } } return array ( $ runsList , $ count ) ; }
Returns list of saved runs
36,612
public static function getAdminTemplate ( $ template , $ module = null ) { $ rtn = null ; $ path = static :: getPath ( $ template , $ module ) ; if ( ! is_null ( $ path ) ) { $ templateSrc = file_get_contents ( $ path . $ template . '.html' ) ; $ rtn = new static ( $ templateSrc ) ; Event :: trigger ( 'AdminTemplateLoaded' , $ rtn ) ; if ( ! is_null ( $ rtn ) ) { $ rtn -> addFunction ( 'hash' , function ( $ args ) { return md5 ( $ args [ 'value' ] ) ; } ) ; } return $ rtn ; } throw new \ Exception ( 'Template does not exist: ' . $ template ) ; }
Load an admin template
36,613
function addArray ( $ arr , & $ n , $ name = "" ) { foreach ( $ arr as $ key => $ val ) { if ( is_int ( $ key ) ) { if ( strlen ( $ name ) > 1 ) { $ newKey = blib_grammar :: singular ( $ name ) ; } else { $ newKey = "item" ; } } else { $ newKey = $ key ; } $ node = $ this -> doc -> createElement ( $ newKey ) ; if ( is_array ( $ val ) ) { $ this -> addArray ( $ arr [ $ key ] , $ node , $ key ) ; } else { $ nodeText = $ this -> doc -> createTextNode ( $ val ) ; $ node -> appendChild ( $ nodeText ) ; } $ n -> appendChild ( $ node ) ; } }
addArray recursive function
36,614
public static function createFromFormat ( $ format , $ time , $ timezone = null ) { if ( null === $ timezone ) { $ parent = parent :: createFromFormat ( $ format , $ time ) ; } else { $ parent = parent :: createFromFormat ( $ format , $ time , $ timezone ) ; } if ( false === $ parent instanceof DateTime ) { return false ; } if ( null === $ timezone ) { return new static ( $ parent -> format ( 'Y-m-d H:i:s.u' ) ) ; } else { return new static ( $ parent -> format ( 'Y-m-d H:i:s.u' ) , $ timezone ) ; } }
Returns new DateTimeImmutable object formatted according to the specified format .
36,615
public function add ( $ interval ) { if ( self :: $ _immutable ) { self :: $ _immutable = false ; $ newDate = clone $ this ; $ newDate -> add ( $ interval ) ; self :: $ _immutable = true ; return $ newDate ; } else { return parent :: add ( $ interval ) ; } }
Adds an amount of days months years hours minutes and seconds .
36,616
public function modify ( $ modify ) { if ( self :: $ _immutable ) { self :: $ _immutable = false ; $ newDate = clone $ this ; $ newDate -> modify ( $ modify ) ; self :: $ _immutable = true ; return $ newDate ; } else { return parent :: modify ( $ modify ) ; } }
Creates a new object with modified timestamp .
36,617
public function setISODate ( $ year , $ week , $ day = null ) { if ( self :: $ _immutable ) { self :: $ _immutable = false ; $ newDate = clone $ this ; $ newDate -> setISODate ( $ year , $ week , $ day ) ; self :: $ _immutable = true ; return $ newDate ; } else { return parent :: setISODate ( $ year , $ week , $ day ) ; } }
Sets the ISO date .
36,618
public function setTimezone ( $ timezone ) { if ( self :: $ _immutable ) { self :: $ _immutable = false ; $ newDate = clone $ this ; $ newDate -> setTimezone ( $ timezone ) ; self :: $ _immutable = true ; return $ newDate ; } else { return parent :: setTimezone ( $ timezone ) ; } }
Sets the time zone .
36,619
public function getLastAccessedAt ( ) { $ timestamp = fileatime ( $ this -> pathname ) ; $ time = new DateTime ( ) ; $ time -> setTimestamp ( $ timestamp ) ; return $ time ; }
Gets last access time .
36,620
public function getCreatedAt ( ) { $ timestamp = filemtime ( $ this -> pathname ) ; $ time = new DateTime ( ) ; $ time -> setTimestamp ( $ timestamp ) ; return $ time ; }
Gets the created time .
36,621
public function getModifiedAt ( ) { $ timestamp = filemtime ( $ this -> pathname ) ; $ time = new DateTime ( ) ; $ time -> setTimestamp ( $ timestamp ) ; return $ time ; }
Gets last modified time .
36,622
public function setGroup ( $ group ) { if ( $ this -> isLink ( ) ) { return lchgrp ( $ this -> pathname , $ group ) ; } else { return chgrp ( $ this -> pathname , $ group ) ; } }
Attempts to change the group .
36,623
public function setMode ( $ mode ) { if ( $ this -> isLink ( ) ) { return lchmod ( $ this -> pathname , $ mode ) ; } else { return chmod ( $ this -> pathname , $ mode ) ; } }
Attempts to change the mode .
36,624
public function copy ( $ destination ) { $ destination = $ this -> getDestination ( $ destination ) ; if ( ! @ copy ( $ this -> getPathname ( ) , $ destination ) ) { throw new FileException ( sprintf ( 'Failed to copy %s to %s' , $ this -> pathname , $ destination ) ) ; } }
Copies the file
36,625
public function move ( $ destination ) { $ destination = $ this -> getDestination ( $ destination ) ; if ( @ rename ( $ this -> getPathname ( ) , $ destination ) ) { $ this -> pathname = $ destination ; } else { throw new FileException ( sprintf ( 'Failed to move %s to %s' , $ this -> pathname , $ destination ) ) ; } }
Moves the file
36,626
private function getDestination ( $ destination ) { $ destination = $ destination instanceof Path ? $ destination : new Path ( $ destination ) ; $ targetDir = new Directory ( $ destination -> getDirname ( ) ) ; $ targetDir -> make ( ) ; return $ destination ; }
Transforms destination into path and ensures parent directory exists
36,627
public function linkTo ( $ destination ) { $ target = new FileDescriptor ( $ destination ) ; $ targetDir = new Directory ( $ target -> getDirname ( ) ) ; $ targetDir -> make ( ) ; $ ok = false ; if ( $ target -> isLink ( ) ) { if ( ! $ target -> getLinkTarget ( ) -> equals ( $ this -> pathname ) ) { $ target -> delete ( ) ; } else { $ ok = true ; } } if ( ! $ ok && @ symlink ( $ this -> pathname , $ target -> getPathname ( ) ) !== true ) { $ report = error_get_last ( ) ; if ( is_array ( $ report ) && DIRECTORY_SEPARATOR === '\\' && strpos ( $ report [ 'message' ] , 'error code(1314)' ) !== false ) { throw new FileException ( 'Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?' ) ; } throw new FileException ( sprintf ( 'Failed to create symbolic link from %s to %s' , $ this -> pathname , $ targetDir ) ) ; } }
Creates a symlink to the given destination
36,628
public function getAttribute ( ) { if ( is_array ( $ this -> attribute ) ) { foreach ( $ this -> attribute as $ name => $ cond ) { list ( $ attr , $ val ) = explode ( '=' , $ cond ) ; if ( $ this -> $ attr == $ val ) { return $ name ; } } } elseif ( $ this -> attribute ) { if ( strpos ( $ this -> attribute , '$' ) === 0 ) { $ attr = substr ( $ this -> attribute , 1 ) ; return $ this -> $ attr ; } return $ this -> attribute ; } return $ this -> backend ( ) -> getDefaultAttribute ( ) ; }
Answers the name used by the rule for the form field attribute .
36,629
public function setValidator ( Validator $ validator ) { $ this -> validator = $ validator ; $ validator -> configureRule ( $ this ) ; return $ this ; }
Defines the value of the validator attribute .
36,630
public function replaceTokens ( $ string ) { foreach ( $ this -> getTokenNames ( $ string ) as $ token ) { $ string = str_replace ( "{{$token}}" , $ this -> getTokenValue ( $ token ) , $ string ) ; } return $ string ; }
Replaces identified tokens within the given string .
36,631
protected function getTokenValue ( $ name ) { $ method = "get{$name}" ; if ( $ this -> hasMethod ( $ method ) ) { return $ this -> { $ method } ( ) ; } return $ this -> $ name ; }
Answers the value of the given token name .
36,632
public static function currentAppsState ( $ registry ) { $ modelStates = [ ] ; foreach ( $ registry -> getModels ( ) as $ modelName => $ modelObj ) { $ modelStates [ $ modelName ] = ModelState :: fromModel ( $ modelObj ) ; } return static :: createObject ( $ modelStates ) ; }
Takes in an Registry and returns a ProjectState matching it .
36,633
public function compileAdd ( Blueprint $ blueprint , Fluent $ command ) { $ table = $ this -> wrapTable ( $ blueprint ) ; $ columns = $ this -> prefixArray ( 'add column' , $ this -> getColumns ( $ blueprint ) ) ; foreach ( $ columns as $ column ) { $ statements [ ] = 'alter table ' . $ table . ' ' . $ column ; } return $ statements ; }
Compile alter table commands for adding columns
36,634
public function bootFlyModel ( ) { FlyModel :: setConnectionResolver ( $ this -> manager ) ; if ( $ dispatcher = $ this -> getEventDispatcher ( ) ) { FlyModel :: setEventDispatcher ( $ dispatcher ) ; } }
Bootstrap FlyModel so it is ready for usage .
36,635
public function addText ( string $ text ) { $ contentConfig = [ 'text' => $ text ] ; $ contentItem = new ContentItem ( $ contentConfig ) ; $ this -> contentItems -> addContentItemToCollection ( $ contentItem ) ; }
Add some plain text
36,636
public function getInsights ( ) { $ cacheKey = sprintf ( '__watson_personality_insights_%s_' , md5 ( serialize ( $ this -> contentItems ) ) ) ; if ( ! $ result = unserialize ( $ this -> cache -> get ( $ cacheKey ) ) || ! $ this -> config -> cache ) { $ result = $ this -> request -> request ( $ this -> config , $ this -> contentItems ) ; $ this -> cache -> put ( $ cacheKey , serialize ( $ result ) , 9999999 ) ; } return $ result ; }
Get the entity analysis
36,637
public function getMigrations ( ) { $ migrations = [ ] ; foreach ( $ this -> getMigrationsClasses ( ) as $ appName => $ classes ) { foreach ( $ classes as $ fileName ) { $ migrationName = $ fileName ; $ migration = $ migrationName :: createObject ( $ fileName ) ; $ migration -> setAppLabel ( $ appName ) ; $ this -> setMigratedApps ( $ appName ) ; $ migrations [ $ fileName ] = $ migration ; } } return $ migrations ; }
List of migration objects .
36,638
public function detectConflicts ( ) { $ conflicts = [ ] ; $ apps = $ this -> graph -> getLeafNodes ( ) ; foreach ( $ apps as $ name => $ latest ) { if ( count ( $ latest ) > 1 ) { $ conflicts [ $ name ] = $ latest ; } } return $ conflicts ; }
An application should only have one leaf node more than that means there is an issue somewhere .
36,639
public function Image ( $ file , $ x = null , $ y = null , $ w = 0 , $ h = 0 , $ type = '' , $ link = '' ) { if ( preg_match ( "/\.png$/i" , $ file ) || strtolower ( $ type ) == "png" ) { $ file = $ this -> fixInterlacedPNG ( $ file ) ; $ type = "png" ; } return parent :: Image ( $ file , $ x , $ y , $ w , $ h , $ type , $ link ) ; }
Override FPDF s Image method to handle interlaced PNGs
36,640
private function fixInterlacedPNG ( $ file ) { if ( isset ( $ this -> interlacedPNGs [ $ file ] ) ) { return $ this -> interlacedPNGs [ $ file ] ; } $ handle = fopen ( $ file , "r" ) ; if ( ! $ handle ) { $ this -> Error ( "Cannot open " . $ file ) ; } $ contents = fread ( $ handle , 32 ) ; fclose ( $ handle ) ; if ( ord ( $ contents [ 28 ] ) != 0 ) { $ im = imagecreatefrompng ( $ file ) ; if ( ! $ im ) { $ this -> Error ( "Cannot create image from " . $ file ) ; } imageinterlace ( $ im , false ) ; imagealphablending ( $ im , true ) ; imagesavealpha ( $ im , true ) ; $ tempname = tempnam ( sys_get_temp_dir ( ) , 'FOO' ) ; $ ret = imagepng ( $ im , $ tempname ) ; imagedestroy ( $ im ) ; if ( ! $ ret ) { $ this -> Error ( "Could not save a non-interlaced version of " . $ file ) ; } $ this -> interlacedPNGs [ $ file ] = $ tempname ; $ this -> toUnlink [ ] = $ tempname ; return $ tempname ; } $ this -> interlacedPNGs [ $ file ] = $ file ; return $ file ; }
Check if PNGs passed are interlaced and make a temporary de - interlaced version if they are .
36,641
public function orderVps ( $ productName , $ addons , $ operatingSystemName , $ hostname ) { return $ this -> getSoapClient ( array_merge ( array ( $ productName , $ addons , $ operatingSystemName , $ hostname ) , array ( '__method' => 'orderVps' ) ) ) -> orderVps ( $ productName , $ addons , $ operatingSystemName , $ hostname ) ; }
Order a VPS with optional Addons
36,642
public function orderAddon ( $ vpsName , $ addons ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ addons ) , array ( '__method' => 'orderAddon' ) ) ) -> orderAddon ( $ vpsName , $ addons ) ; }
Order addons to a VPS
36,643
public function upgradeVps ( $ vpsName , $ upgradeToProductName ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ upgradeToProductName ) , array ( '__method' => 'upgradeVps' ) ) ) -> upgradeVps ( $ vpsName , $ upgradeToProductName ) ; }
upgrade a Vps
36,644
public function cancelVps ( $ vpsName , $ endTime ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ endTime ) , array ( '__method' => 'cancelVps' ) ) ) -> cancelVps ( $ vpsName , $ endTime ) ; }
Cancel a Vps
36,645
public function cancelAddon ( $ vpsName , $ addonName ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ addonName ) , array ( '__method' => 'cancelAddon' ) ) ) -> cancelAddon ( $ vpsName , $ addonName ) ; }
Cancel a Vps Addon
36,646
public function cancelPrivateNetwork ( $ privateNetworkName , $ endTime ) { return $ this -> getSoapClient ( array_merge ( array ( $ privateNetworkName , $ endTime ) , array ( '__method' => 'cancelPrivateNetwork' ) ) ) -> cancelPrivateNetwork ( $ privateNetworkName , $ endTime ) ; }
Cancel a PrivateNetwork
36,647
public function addVpsToPrivateNetwork ( $ vpsName , $ privateNetworkName ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ privateNetworkName ) , array ( '__method' => 'addVpsToPrivateNetwork' ) ) ) -> addVpsToPrivateNetwork ( $ vpsName , $ privateNetworkName ) ; }
Add VPS to a private Network
36,648
public function removeVpsFromPrivateNetwork ( $ vpsName , $ privateNetworkName ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ privateNetworkName ) , array ( '__method' => 'removeVpsFromPrivateNetwork' ) ) ) -> removeVpsFromPrivateNetwork ( $ vpsName , $ privateNetworkName ) ; }
Remove VPS from a private Network
36,649
public function createSnapshot ( $ vpsName , $ description ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ description ) , array ( '__method' => 'createSnapshot' ) ) ) -> createSnapshot ( $ vpsName , $ description ) ; }
Create a snapshot
36,650
public function revertSnapshot ( $ vpsName , $ snapshotName ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ snapshotName ) , array ( '__method' => 'revertSnapshot' ) ) ) -> revertSnapshot ( $ vpsName , $ snapshotName ) ; }
Revert a snapshot
36,651
public function removeSnapshot ( $ vpsName , $ snapshotName ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ snapshotName ) , array ( '__method' => 'removeSnapshot' ) ) ) -> removeSnapshot ( $ vpsName , $ snapshotName ) ; }
Remove a snapshot
36,652
public function installOperatingSystem ( $ vpsName , $ operatingSystemName , $ hostname ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ operatingSystemName , $ hostname ) , array ( '__method' => 'installOperatingSystem' ) ) ) -> installOperatingSystem ( $ vpsName , $ operatingSystemName , $ hostname ) ; }
Install an operating system on a vps
36,653
public function installOperatingSystemUnattended ( $ vpsName , $ operatingSystemName , $ base64InstallText ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ operatingSystemName , $ base64InstallText ) , array ( '__method' => 'installOperatingSystemUnattended' ) ) ) -> installOperatingSystemUnattended ( $ vpsName , $ operatingSystemName , $ base64InstallText ) ; }
Install an operating system on a vps with a unattended installfile .
36,654
public function addIpv6ToVps ( $ vpsName , $ ipv6Address ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ ipv6Address ) , array ( '__method' => 'addIpv6ToVps' ) ) ) -> addIpv6ToVps ( $ vpsName , $ ipv6Address ) ; }
Add Ipv6 Address to Vps
36,655
public function setCustomerLock ( $ vpsName , $ enabled ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ enabled ) , array ( '__method' => 'setCustomerLock' ) ) ) -> setCustomerLock ( $ vpsName , $ enabled ) ; }
Enable or Disable a Customer Lock for a Vps
36,656
public function handoverVps ( $ vpsName , $ targetAccountname ) { return $ this -> getSoapClient ( array_merge ( array ( $ vpsName , $ targetAccountname ) , array ( '__method' => 'handoverVps' ) ) ) -> handoverVps ( $ vpsName , $ targetAccountname ) ; }
Handover a VPS to another TransIP User
36,657
public function dispatchSignal ( $ signal_name , $ object ) { if ( $ this -> _signal ) { $ this -> signal -> dispatch ( $ signal_name , $ object ) ; } }
Dispatch signals if the Dispatch library is loaded .
36,658
public function setPassword ( $ user , $ password , $ algorithm = self :: ALG_MD5 , array $ options = null ) { $ this -> load ( ) ; $ new = ! isset ( $ this -> users [ $ user ] ) ; if ( $ new ) { $ oUser = new User ( $ user ) ; $ oUser -> setPassword ( $ password , $ algorithm , $ options ) ; $ this -> users [ $ user ] = $ oUser ; } else { $ this -> users [ $ user ] -> setPassword ( $ password , $ algorithm , $ options ) ; } return $ new ; }
Sets the password for a user
36,659
public function remove ( $ user ) { $ this -> load ( ) ; if ( ! isset ( $ this -> users [ $ user ] ) ) { return false ; } unset ( $ this -> users [ $ user ] ) ; return true ; }
Removes a user from the file
36,660
public function setFileName ( $ filename ) { $ this -> load ( ) ; $ this -> filename = $ filename ; $ this -> io = new Real ( $ filename ) ; }
Sets new filename
36,661
private function load ( ) { if ( $ this -> users ) { return null ; } $ content = $ this -> io -> load ( ) ; $ this -> users = [ ] ; foreach ( explode ( "\n" , $ content ) as $ line ) { $ line = trim ( $ line ) ; if ( $ line !== '' ) { $ user = User :: loadFromFileLine ( $ line ) ; if ( $ user === null ) { return $ this -> invalid ( ) ; } $ this -> users [ $ user -> getName ( ) ] = $ user ; } } return null ; }
Loads a user list from file
36,662
public function edit ( TagRequest $ request , Tag $ tag ) { return $ this -> response -> title ( trans ( 'app.edit' ) . ' ' . trans ( 'blog::tag.name' ) ) -> view ( 'blog::tag.edit' , true ) -> data ( compact ( 'tag' ) ) -> output ( ) ; }
Show tag for editing .
36,663
public function update ( TagRequest $ request , Tag $ tag ) { try { $ attributes = $ request -> all ( ) ; $ tag -> update ( $ attributes ) ; return $ this -> response -> message ( trans ( 'messages.success.updated' , [ 'Module' => trans ( 'blog::tag.name' ) ] ) ) -> code ( 204 ) -> status ( 'success' ) -> url ( guard_url ( 'blog/tag/' . $ tag -> getRouteKey ( ) ) ) -> redirect ( ) ; } catch ( Exception $ e ) { return $ this -> response -> message ( $ e -> getMessage ( ) ) -> code ( 400 ) -> status ( 'error' ) -> url ( guard_url ( 'blog/tag/' . $ tag -> getRouteKey ( ) ) ) -> redirect ( ) ; } }
Update the tag .
36,664
public function destroy ( TagRequest $ request , Tag $ tag ) { try { $ tag -> delete ( ) ; return $ this -> response -> message ( trans ( 'messages.success.deleted' , [ 'Module' => trans ( 'blog::tag.name' ) ] ) ) -> code ( 202 ) -> status ( 'success' ) -> url ( guard_url ( 'blog/tag/0' ) ) -> redirect ( ) ; } catch ( Exception $ e ) { return $ this -> response -> message ( $ e -> getMessage ( ) ) -> code ( 400 ) -> status ( 'error' ) -> url ( guard_url ( 'blog/tag/' . $ tag -> getRouteKey ( ) ) ) -> redirect ( ) ; } }
Remove the tag .
36,665
public function getRoot ( $ title ) { if ( array_key_exists ( $ title , $ this -> menu ) ) { return $ this -> menu [ $ title ] ; } return null ; }
Get the root item for the requested title
36,666
protected function setupControllerMenus ( ) { $ this -> config = Config :: getInstance ( ) ; $ paths = Config :: getInstance ( ) -> get ( 'Octo.paths.namespaces' ) ; foreach ( $ paths as $ namespace => $ path ) { $ thisPath = $ path . 'Admin/Controller/*.php' ; $ files = glob ( $ thisPath ) ; foreach ( $ files as $ file ) { $ this -> getControllerMenuItems ( $ file , $ namespace ) ; } } }
Setup the menus for each controller
36,667
protected function getControllerMenuItems ( $ file , $ namespace ) { $ controller = '\\' . $ namespace . '\\Admin\\Controller\\' . str_replace ( '.php' , '' , basename ( $ file ) ) ; if ( method_exists ( $ controller , 'registerMenus' ) ) { $ controller :: registerMenus ( $ this ) ; } }
Get menus for each controller
36,668
public function prepareCapabilities ( array $ capabilities = [ ] ) : array { if ( empty ( $ capabilities ) ) { return [ ] ; } $ result = [ ] ; foreach ( $ capabilities as $ capName => $ checked ) { $ checked = ( bool ) $ checked ; if ( ! $ checked ) { continue ; } $ capEntity = $ this -> Capabilities -> newEntity ( ) ; $ capEntity -> name = $ capName ; $ result [ ] = $ capEntity ; } return $ result ; }
Method that prepares associated Capabilities records to be created .
36,669
protected function setupMiddleware ( ) { $ this -> editorFormat = StoryFormat :: get ( Input :: get ( 'format' ) ) ; $ this -> middleware ( 'orchestra.auth' ) ; $ this -> middleware ( "orchestra.story.editor:{$this->editorFormat}" ) ; }
Define the middleware .
36,670
public function relabeledClone ( $ changeMap = [ ] ) { $ newParentAlias = ArrayHelper :: getValue ( $ changeMap , $ this -> parentAlias , $ this -> parentAlias ) ; $ tableAlias = ArrayHelper :: getValue ( $ changeMap , $ this -> tableAlias , $ this -> tableAlias ) ; $ join = new static ( ) ; $ join -> setTableName ( $ this -> getTableName ( ) ) ; $ join -> setParentAlias ( $ newParentAlias ) ; $ join -> setTableAlias ( $ tableAlias ) ; $ join -> setJoinType ( $ this -> getJoinType ( ) ) ; $ join -> setJoinField ( $ this -> getJoinField ( ) ) ; $ join -> setNullable ( $ this -> getNullable ( ) ) ; return $ join ; }
Clone join with the option of relabeling the aliases .
36,671
public function equal ( $ item ) { if ( $ item instanceof static ) { $ v = $ this -> tableName == $ item -> tableName ; return $ this -> tableName == $ item -> tableName && $ this -> parentAlias == $ item -> parentAlias && get_class ( $ this -> joinField ) === get_class ( $ item -> joinField ) ; } return false ; }
Check if pass in item is equal to this one .
36,672
public function fileHeader ( $ header ) { $ this -> fileHeader = is_array ( $ header ) ? implode ( "\n" , $ header ) : ( string ) $ header ; return $ this ; }
Lines that will be added as comment to the beginning of the output file
36,673
public function useBoilerplate ( $ path , $ format = null ) { $ this -> boilerplatePath = $ path ; $ this -> boilerplateFormat = $ format ; return $ this ; }
Configure from which file the basic values will be read from
36,674
protected function getParameters ( ) { $ boilerplateParameters = $ this -> readFromBoilerplate ( ) ; $ environmentParameters = $ this -> tryToLoadFromEnvironment ( $ this -> loadFromEnvironment ) ; $ missingInEnvironment = array_diff ( $ this -> loadFromEnvironment , array_keys ( $ environmentParameters ) ) ; if ( $ missingInEnvironment && $ this -> failOnMissingEnvVariables ) { throw new TaskException ( $ this , 'Some parameters could not be found via environment: ' . implode ( ', ' , $ this -> getEnvName ( $ missingInEnvironment ) ) ) ; } return array_replace_recursive ( $ boilerplateParameters , $ environmentParameters , $ this -> parameters ) ; }
Load the parameters from the various sources and return the combined array
36,675
protected function tryToLoadFromEnvironment ( array $ names ) { $ ret = array ( ) ; foreach ( $ names as $ name ) { $ envName = $ this -> getEnvName ( $ name ) ; $ value = getenv ( $ envName ) ; if ( $ value !== false ) { $ ret [ $ name ] = $ value ; } } return $ ret ; }
Try to load the given variables from environment variables Returns an array with names as keys and possible found values
36,676
public function registerCard ( string $ urlReturn = null ) { if ( $ this -> exists ) { return $ this -> service -> registerCard ( $ this -> getId ( ) , $ urlReturn ) ; } return false ; }
Creates a petition to Register the Credit Card of this Customer
36,677
public function charge ( array $ attributes ) { if ( $ this -> exists && $ this -> creditCardType && $ this -> last4CardDigits ) { return $ this -> service -> charge ( $ attributes + [ $ this -> getIdKey ( ) => $ this -> getId ( ) ] ) ; } return false ; }
Immediately charges a desired amount into the registered Credit Card
36,678
public function reverseCharge ( string $ idType , string $ value ) { if ( $ this -> exists ) { return $ this -> service -> reverseCharge ( $ idType ?? 'customerOrder' , $ value ) ; } return false ; }
Immediately reverses a previously made charge for this customer
36,679
public function getChargesPage ( string $ page , array $ options = null ) { if ( $ this -> exists ) { return $ this -> service -> getChargesPage ( $ this -> getId ( ) , $ page , $ options ) ; } return false ; }
List the charges made to this customer
36,680
public function getFields ( ) { if ( $ this -> existing ( ) ) { return TableDumper :: make ( $ this -> getEntities ( ) ) -> toSchema ( ) ; } return $ this -> console -> option ( 'fields' ) ; }
Get schema fields .
36,681
public function generateModel ( ) { if ( ! $ this -> confirm ( 'Do you want to create a model?' ) ) { return ; } $ this -> console -> call ( 'generate:model' , [ 'name' => $ this -> getEntity ( ) , '--fillable' => $ this -> getFields ( ) , '--force' => $ this -> console -> option ( 'force' ) , ] ) ; }
Generate model .
36,682
public function generateSeed ( ) { if ( ! $ this -> confirm ( 'Do you want to create a database seeder class?' ) ) { return ; } $ this -> console -> call ( 'generate:seed' , [ 'name' => $ this -> getEntities ( ) , '--force' => $ this -> console -> option ( 'force' ) , ] ) ; }
Generate seed .
36,683
public function generateController ( ) { if ( ! $ this -> confirm ( 'Do you want to generate a controller?' ) ) { return ; } $ this -> console -> call ( 'generate:controller' , [ 'name' => $ this -> getControllerName ( ) , '--force' => $ this -> console -> option ( 'force' ) , '--scaffold' => true , ] ) ; }
Generate controller .
36,684
public function generateViewLayout ( ) { if ( $ this -> confirm ( 'Do you want to create master view?' ) ) { $ this -> console -> call ( 'generate:view' , [ 'name' => $ this -> getViewLayout ( ) , '--master' => true , '--force' => $ this -> console -> option ( 'force' ) , ] ) ; } }
Generate a view layout .
36,685
public function generateView ( $ view ) { $ generator = new ViewGenerator ( [ 'name' => $ this -> getPrefix ( '/' ) . $ this -> getEntities ( ) . '/' . $ view , 'extends' => str_replace ( '/' , '.' , $ this -> getViewLayout ( ) ) , 'template' => '/scaffold/views/' . $ view . '.stub' , 'force' => $ this -> console -> option ( 'force' ) , ] ) ; $ generator -> appendReplacement ( array_merge ( $ this -> getControllerScaffolder ( ) -> toArray ( ) , [ 'lower_plural_entity' => strtolower ( $ this -> getEntities ( ) ) , 'studly_singular_entity' => Str :: studly ( $ this -> getEntity ( ) ) , 'form' => $ this -> getFormGenerator ( ) -> render ( ) , 'table_heading' => $ this -> getTableDumper ( ) -> toHeading ( ) , 'table_body' => $ this -> getTableDumper ( ) -> toBody ( $ this -> getEntity ( ) ) , 'show_body' => $ this -> getTableDumper ( ) -> toRows ( $ this -> getEntity ( ) ) , ] ) ) ; $ generator -> run ( ) ; $ this -> console -> info ( 'View created successfully.' ) ; }
Generate a scaffold view .
36,686
public function appendRoute ( ) { if ( ! $ this -> confirm ( 'Do you want to append new route?' ) ) { return ; } $ contents = $ this -> laravel [ 'files' ] -> get ( $ path = app_path ( 'Http/routes.php' ) ) ; $ contents .= PHP_EOL . "Route::group(['middleware' => ['web']], function () {" ; $ contents .= PHP_EOL . "\tRoute::resource('{$this->getRouteName()}', '{$this->getControllerName()}');" ; $ contents .= PHP_EOL . "});" ; $ this -> laravel [ 'files' ] -> put ( $ path , $ contents ) ; $ this -> console -> info ( 'Route appended successfully.' ) ; }
Append new route .
36,687
public function getRouteName ( ) { $ route = $ this -> getEntities ( ) ; if ( $ this -> console -> option ( 'prefix' ) ) { $ route = strtolower ( $ this -> getPrefix ( '/' ) ) . $ route ; } return $ route ; }
Get route name .
36,688
public function getPrefix ( $ suffix = null ) { $ prefix = $ this -> console -> option ( 'prefix' ) ; return $ prefix ? $ prefix . $ suffix : null ; }
Get prefix name .
36,689
private function addJobs ( ) { foreach ( $ this -> cronjobs as $ jobName => $ jobConfig ) { $ this -> addJob ( $ jobName , $ jobConfig ) ; } }
Add plugin cron jobs
36,690
private function removeJobs ( ) { foreach ( $ this -> cronjobs as $ jobName => $ jobConfig ) { unset ( $ jobConfig [ 'schedule' ] ) ; $ this -> scheduler -> removeJob ( $ jobName , $ jobConfig ) ; } }
Remove plugin cron jobs
36,691
private function setPermissions ( ) { $ this -> pluginsService -> savePluginPermissions ( $ this -> pluginsService -> collectPermissions ( $ this -> translator -> trans ( 'plugin.ingest.permissions.label' ) ) ) ; }
Save plugin permissions into database
36,692
private function removePermissions ( ) { $ this -> pluginsService -> removePluginPermissions ( $ this -> pluginsService -> collectPermissions ( $ this -> translator -> trans ( 'plugin.ingest.permissions.label' ) ) ) ; }
Remove plugin permissions
36,693
public function manage ( Process ... $ processes ) { $ unbounded = ( $ this -> poolSize < 0 ) ; foreach ( $ processes as $ process ) { if ( ! $ unbounded && ( -- $ this -> poolSize < 0 ) ) { throw new LogicException ( "PooledExecutor pool size [{$this->poolSize}] exceeded." ) ; } $ this -> processes [ $ process -> getPid ( ) ] = $ process ; } return $ this ; }
Manage a selected process .
36,694
public function start ( ) { foreach ( $ this -> processes as $ pid => $ process ) { if ( ! $ process -> isStarted ( ) ) { $ process -> runAsync ( ) ; } } }
Run each managed process .
36,695
public function join ( ) { while ( true ) { $ finished = true ; foreach ( $ this -> processes as $ pid => $ process ) { if ( $ process -> isAlive ( ) ) { $ finished = false ; break ; } } if ( $ finished ) { break ; } unset ( $ finished ) ; usleep ( 10000 ) ; } }
Block execution until each managed process has completed .
36,696
public function hasAlive ( ) { foreach ( $ this -> processes as $ pid => $ process ) { if ( $ process -> isAlive ( ) ) { return true ; } } return false ; }
Check if any managed processes are still running .
36,697
public function abandon ( ) { foreach ( $ this -> processes as $ index => $ process ) { $ process -> kill ( ) ; unset ( $ process [ $ index ] ) ; } unset ( $ this -> processes ) ; }
Abandon the currently managed processes .
36,698
public function queryset ( $ modelInstance , $ reverse = true ) { if ( $ reverse ) { $ model = $ this -> field -> getRelatedModel ( ) ; } else { $ model = $ this -> field -> scopeModel ; } if ( ! class_exists ( '\Eddmash\PowerOrm\Model\Manager\BaseM2OManager' , false ) ) { $ baseClass = $ model :: getManagerClass ( ) ; $ class = sprintf ( 'namespace Eddmash\PowerOrm\Model\Manager;class BaseM2OManager extends \%s{}' , $ baseClass ) ; eval ( $ class ) ; } $ manager = M2OManager :: createObject ( [ 'model' => $ model , 'rel' => $ this -> field -> relation , 'instance' => $ modelInstance , 'reverse' => $ reverse , ] ) ; return $ manager ; }
Creates the queryset to retrieve data for the relationship that relates to this field .
36,699
public function publish ( $ source , $ destination ) { $ add = 0 ; $ published = array ( ) ; foreach ( $ this -> getFreshMigrations ( $ source , $ destination ) as $ file ) { $ add ++ ; $ newName = $ this -> getNewMigrationName ( $ file , $ add ) ; $ this -> files -> copy ( $ file , $ newName = $ destination . '/' . $ newName ) ; $ published [ ] = $ newName ; } return $ published ; }
Publish the given package s migrations .