_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q23400
Zip.listContents
train
public function listContents($zipFile, array $options = []) { $fs = $this->getFilesystem(); if (!$fs->isFile($zipFile)) { throw new Exception(t('Unable to find the ZIP file %s', $zipFile)); } $options += [ 'skipCheck' => false, 'excludeDirs' => fal...
php
{ "resource": "" }
q23401
Zip.unzipNative
train
protected function unzipNative($zipFile, $destinationDirectory, array $options) { $cmd = 'unzip'; $cmd .= ' -o'; // overwrite files WITHOUT prompting $cmd .= ' -q'; // quiet mode, to avoid overflow of stdout $cmd .= ' ' . escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $zipFile)...
php
{ "resource": "" }
q23402
Zip.unzipPHP
train
protected function unzipPHP($zipFile, $destinationDirectory, array $options) { if (!class_exists('ZipArchive')) { throw new Exception('Unable to unzip files using ZipArchive. Please ensure the Zip extension is installed.'); } $zip = new ZipArchive(); try { $fl...
php
{ "resource": "" }
q23403
Zip.zipPHP
train
protected function zipPHP($sourceDirectory, $zipFile, array $options) { if (!class_exists('ZipArchive')) { throw new Exception('Unable to zip files using ZipArchive. Please ensure the Zip extension is installed.'); } $zip = new ZipArchive(); try { $flags = Zip...
php
{ "resource": "" }
q23404
MutexTrait.getFilenameForMutexKey
train
protected function getFilenameForMutexKey($mutexKey) { $mutexKeyString = (is_string($mutexKey) || is_int($mutexKey)) ? (string) $mutexKey : ''; if ($mutexKeyString === '') { throw new InvalidMutexKeyException($mutexKey); } if (preg_match('/^[a-zA-Z0-9_\-]{1,50}$/', $mutex...
php
{ "resource": "" }
q23405
FileList.filterByTag
train
public function filterByTag($tag = '') { $db = Loader::db(); $this->filter(false,
php
{ "resource": "" }
q23406
FileList.get
train
public function get($itemsToGet = 0, $offset = 0) { $files = array(); $this->createQuery(); $r = parent::get($itemsToGet, $offset); foreach ($r as $row) {
php
{ "resource": "" }
q23407
PluginManager.register
train
public function register($plugin, $name = null) { if ($plugin instanceof Plugin) { $key = $plugin->getKey(); $p = $plugin; } else { if (!$name) { throw new Exception(t('You must specify a plugin key and name.'));
php
{ "resource": "" }
q23408
Node.load_starting
train
public function load_starting() { $node = $this->loadNode(); $r = array(); foreach ($node->getChildNodes() as $childnode) { $json = $childnode->getTreeNodeJSON(); if ($json) {
php
{ "resource": "" }
q23409
Node.load
train
public function load() { $node = $this->loadNode(); $r = array(); foreach ($node->getChildNodes() as $childnode) {
php
{ "resource": "" }
q23410
ApplicationMiddleware.process
train
public function process(Request $request, DelegateInterface $frame) { \Concrete\Core\Http\Request::setInstance($request);
php
{ "resource": "" }
q23411
GroupList.filterByAssignable
train
public function filterByAssignable() { if (Config::get('concrete.permissions.model') != 'simple') { // there's gotta be a more reasonable way than this but right now i'm not sure what that is. $excludeGroupIDs = [GUEST_GROUP_ID, REGISTERED_GROUP_ID]; $db = Loader::db(); ...
php
{ "resource": "" }
q23412
EditResponse.hasError
train
public function hasError() { $error = $this->getError(); if ($error instanceof ErrorList) {
php
{ "resource": "" }
q23413
EditResponse.getBaseJSONObject
train
public function getBaseJSONObject() { $o = new stdClass(); $error = $this->getError(); if ($error instanceof Exception) { $o->error = true; $o->errors = [$error->getMessage()]; } elseif ($error instanceof ErrorList && $error->has()) { $o->error = t...
php
{ "resource": "" }
q23414
Integrations.create
train
public function create() { $this->add(); $this->validateIntegrationRequest(); if (!$this->token->validate('create')) { $this->error->add($this->token->getErrorMessage()); } if ($this->error->has()) { return; } $factory = $this->app->m...
php
{ "resource": "" }
q23415
StandardFormatter.getString
train
public function getString() { $html = ''; if ($this->error->has()) { $html .= '<ul class="ccm-error">'; foreach ($this->error->getList() as $error) { $html .= '<li>'; if ($error instanceof HtmlAwareErrorInterface && $error->messageContainsHtml(...
php
{ "resource": "" }
q23416
Logging.view
train
public function view($strStatus = false) { $config = $this->app->make('config'); $strStatus = (string) $strStatus; $intLogErrors = $config->get('concrete.log.errors') == 1 ? 1 : 0; $intLogEmails = $config->get('concrete.log.emails') == 1 ? 1 : 0; $this->set('fh', Loader::hel...
php
{ "resource": "" }
q23417
Logging.update_logging
train
public function update_logging() { $config = $this->app->make('config'); if (!$this->token->validate('update_logging')) { $this->error->add($this->token->getErrorMessage()); } if ($this->request->request->get('handler') == 'file' && $this->request->request->get('logging_m...
php
{ "resource": "" }
q23418
Installer.createConnection
train
public function createConnection() { $pdoCheck = $this->application->make(PdoMysqlExtension::class)->performCheck(); if ($pdoCheck->getState() !== PreconditionResult::STATE_PASSED) { throw new UserMessageException($pdoCheck->getMessage()); } $databaseConfiguration = $this...
php
{ "resource": "" }
q23419
Installer.getStartingPoint
train
public function getStartingPoint($fallbackToDefault) { $handle = $this->getOptions()->getStartingPointHandle(); if ($handle === '') { if (!$fallbackToDefault) { throw new UserMessageException(t('The starting point has not been defined.'));
php
{ "resource": "" }
q23420
Factory.getTranslationsStats
train
protected function getTranslationsStats(Translations $translations, DateTime $defaultUpdatedOn) { $result = null; foreach ($translations as $translation) { if ($translation->hasTranslation()) { $result = [ 'version' => '', 'updatedO...
php
{ "resource": "" }
q23421
Factory.getMoFileStats
train
protected function getMoFileStats($moFile) { if ($this->fs->isFile($moFile)) { $lastModifiedTimestamp = $this->fs->lastModified($moFile); if ($this->cache->isEnabled()) { $cacheItem = $this->cache->getItem(self::CACHE_PREFIX . '/' . md5($moFile) . '_' . $lastModifiedT...
php
{ "resource": "" }
q23422
UserList.get
train
public function get($itemsToGet = 100, $offset = 0) { $userInfos = array(); $this->createQuery(); $r = parent::get($itemsToGet, intval($offset)); foreach ($r as $row) {
php
{ "resource": "" }
q23423
UserList.getUserIDs
train
public function getUserIDs($itemsToGet = 100, $offset = 0) { $this->createQuery(); $userIDs = array(); $r = parent::get($itemsToGet, intval($offset));
php
{ "resource": "" }
q23424
IPAddress.setIp
train
public function setIp($ipAddress, $isHex = false) { if ($isHex) { $this->ipHex = $ipAddress; } else { //discard any IPv6 port $ipAddress = preg_replace('/\[(.*?)\].*/', '$1', $ipAddress); //discard any IPv4 port if (strpos($ipAddress, '.') ...
php
{ "resource": "" }
q23425
IPAddress.getIp
train
public function getIp($format = self::FORMAT_HEX) { if ($this->ipHex === null) { return null; } elseif ($format === self::FORMAT_HEX) { return $this->ipHex; } elseif ($format === self::FORMAT_IP_STRING) {
php
{ "resource": "" }
q23426
IPAddress.isLoopBack
train
public function isLoopBack() { if (!$this->isIpSet()) { throw new \Exception('No IP Set'); } if ($this->isIPv4() && strpos($this->ipHex, '7f') === 0) { return true; //IPv4 loopback 127.0.0.0/8 } elseif ($this->ipHex === '00000000000000000000000000000001' ...
php
{ "resource": "" }
q23427
IPAddress.isPrivate
train
public function isPrivate() { if (!$this->isIpSet()) { throw new \Exception('No IP Set'); } if ( ($this->isIPv4() && (strpos($this->ipHex, '0a') === 0 //10.0.0.0/8 || strpos($this->ipHex, 'ac1') === 0 //172.16.0.0/12 || ...
php
{ "resource": "" }
q23428
Workflow.getWorkflowProgressCurrentStatusNum
train
public function getWorkflowProgressCurrentStatusNum(WorkflowProgress $wp) { $req =
php
{ "resource": "" }
q23429
LoginAttemptRepository.before
train
public function before(DateTime $before, $user = null, $count = false) { // Validate and normalize input $before = $this->validateTimezone($before); $user = $this->validateUser($user); // Build the query builder $qb = $this->createQueryBuilder('a'); if ($count) { ...
php
{ "resource": "" }
q23430
LoginAttemptRepository.validateUser
train
private function validateUser($user, $requireValue = false) { // If we're passed something falsy, just return null if (!$user && !$requireValue) { return null; } // If we have a known supported type, resolve the id and return it
php
{ "resource": "" }
q23431
AuthCodeRepository.persistNewAuthCode
train
public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity) { $this->getEntityManager()->transactional(function(EntityManagerInterface $entityManager) use
php
{ "resource": "" }
q23432
AuthCodeRepository.revokeAuthCode
train
public function revokeAuthCode($codeId) { $code = $this->find($codeId); if (!$code) { throw new \InvalidArgumentException('Invalid auth token code'); }
php
{ "resource": "" }
q23433
SearchProvider.getItemsPerPage
train
public function getItemsPerPage() { $query = $this->getSessionCurrentQuery(); if ($query) { return $query->getItemsPerPage();
php
{ "resource": "" }
q23434
DatabaseQueueAdapter.getQueueId
train
protected function getQueueId($name) { $r = $this->db->fetchColumn('select queue_id from Queues where queue_name = ? limit 1', [$name]);
php
{ "resource": "" }
q23435
Text.encodePath
train
public static function encodePath($path) { if (mb_strpos($path, '/') !== false) { $path = explode('/', $path); $path = array_map('rawurlencode', $path); $newPath = implode('/', $path); } else { if (is_null($path)) { $newPath = null; ...
php
{ "resource": "" }
q23436
Text.slugSafeString
train
public function slugSafeString($handle, $maxlength = 128) { $handle = preg_replace('/[^\\p{L}\\p{Nd}\-_]+/u', ' ', $handle); // remove unneeded chars $handle = preg_replace('/[-\s]+/', '-', $handle); // convert spaces
php
{ "resource": "" }
q23437
Text.sanitize
train
public function sanitize($string, $max_length = 0, $allowed = '') { $text = trim(strip_tags($string, $allowed)); if ($max_length > 0) { if (function_exists('mb_substr')) { $text = mb_substr($text, 0, $max_length, APP_CHARSET); } else { $text = ...
php
{ "resource": "" }
q23438
Text.makenice
train
public function makenice($input) { $output = strip_tags($input); $output = $this->autolink($output);
php
{ "resource": "" }
q23439
Text.autolink
train
public function autolink($input, $newWindow = false, $defaultProtocol = 'http://') { $target = $newWindow ? ' target="_blank"' : ''; $output = preg_replace_callback( '/(http:\/\/|https:\/\/|(www\.))(([^\s<]{4,80})[^\s<]*)/', function (array $matches) use ($target, $defaultPro...
php
{ "resource": "" }
q23440
Text.handle
train
public function handle($handle, $leaveSlashes = false) { $handle = $this->sanitizeFileSystem($handle,
php
{ "resource": "" }
q23441
Text.urlify
train
public function urlify($handle, $max_length = null, $locale = '', $removeExcludedWords = true) { if ($max_length === null) { $max_length = Config::get('concrete.seo.segment_max_length'); } $text = strtolower(str_replace(array("\r", "\n", "\t"), ' ', $this->asciify($handle, $local...
php
{ "resource": "" }
q23442
Text.highlightSearch
train
public function highlightSearch($value, $searchString) { if (strlen($value) < 1 || strlen($searchString) < 1) { return $value; } preg_match_all("/$searchString+/i", $value, $matches); if (is_array($matches[0]) && count($matches[0]) > 0) {
php
{ "resource": "" }
q23443
Text.appendXML
train
public function appendXML(\SimpleXMLElement $root, \SimpleXMLElement $new) { $node = $root->addChild($new->getName(), (string) $new);
php
{ "resource": "" }
q23444
UserInterface.submit
train
public function submit($text, $formID = false, $buttonAlign = 'right', $innerClass = null, $args = []) { if ('right' == $buttonAlign) { $innerClass .= ' pull-right'; } elseif ('left' == $buttonAlign) { $innerClass .= ' pull-left'; } if (!$formID) { ...
php
{ "resource": "" }
q23445
UserInterface.button
train
public function button($text, $href, $buttonAlign = 'right', $innerClass = null, $args = []) { if ('right' == $buttonAlign) { $innerClass .= ' pull-right'; } elseif ('left' == $buttonAlign) {
php
{ "resource": "" }
q23446
UserInterface.buttonJs
train
public function buttonJs($text, $onclick, $buttonAlign = 'right', $innerClass = null, $args = []) { if ('right' == $buttonAlign) { $innerClass .= ' pull-right'; } elseif ('left' == $buttonAlign) { $innerClass .= ' pull-left'; } $argsstr = ''; foreach (...
php
{ "resource": "" }
q23447
UserInterface.showHelpOverlay
train
public function showHelpOverlay() { $result = false; if (Config::get('concrete.misc.help_overlay')) { $u = new
php
{ "resource": "" }
q23448
MailImportedMessage.getProcessedBody
train
public function getProcessedBody() { $r = preg_split(MailImporter::getMessageBodyHashRegularExpression(), $this->body); $message = $r[0]; $r = preg_replace(array( '/^On (.*)
php
{ "resource": "" }
q23449
MailImportedMessage.validate
train
public function validate() { if (!$this->validationHash) { return false; } $db = Database::connection(); $row = $db->GetRow("select * from MailValidationHashes where mHash = ? order by mDateGenerated desc limit 1", $this->validationHash); if ($row['mvhID'] > 0) { ...
php
{ "resource": "" }
q23450
MailImportedMessage.isSendError
train
public function isSendError() { $message = $this->getOriginalMessageObject(); $headers = $message->getHeaders(); $isSendError = false; if (is_array($headers) && count($headers)) { foreach (array_keys($headers) as $key) {
php
{ "resource": "" }
q23451
Concrete5UserProcessor.getLoggedInUser
train
protected function getLoggedInUser() { if (!$this->user) {
php
{ "resource": "" }
q23452
Key.loadAll
train
public static function loadAll() { $app = Application::getFacadeApplication(); $db = $app->make(Connection::class); $permissionkeys = []; $txt = $app->make('helper/text'); $e = $db->executeQuery(<<<'EOT' select pkID, pkName, pkDescription, pkHandle, pkCategoryHandle, pkCanTri...
php
{ "resource": "" }
q23453
Key.getPackageHandle
train
public function getPackageHandle() { $pkgID = $this->getPackageID();
php
{ "resource": "" }
q23454
Key.getList
train
public static function getList($pkCategoryHandle, $filters = []) { $app = Application::getFacadeApplication(); $db = $app->make(Connection::class); $q = 'select pkID from PermissionKeys inner join PermissionKeyCategories on PermissionKeys.pkCategoryID = PermissionKeyCategories.pkCategoryID w...
php
{ "resource": "" }
q23455
Key.export
train
public function export($axml) { $category = PermissionKeyCategory::getByID($this->pkCategoryID)->getPermissionKeyCategoryHandle(); $pkey = $axml->addChild('permissionkey'); $pkey->addAttribute('handle', $this->getPermissionKeyHandle()); $pkey->addAttribute('name', $this->getPermissio...
php
{ "resource": "" }
q23456
Key.exportList
train
public static function exportList($xml) { $categories = PermissionKeyCategory::getList(); $pxml = $xml->addChild('permissionkeys'); foreach ($categories as $cat) {
php
{ "resource": "" }
q23457
Key.getListByPackage
train
public static function getListByPackage($pkg) { $app = Application::getFacadeApplication(); $db = $app->make(Connection::class); $kina = ['-1']; $rs = $db->executeQuery('select pkCategoryID from PermissionKeyCategories where pkgID = ?', [$pkg->getPackageID()]); while (($pkCa...
php
{ "resource": "" }
q23458
Key.import
train
public static function import(SimpleXMLElement $pk) { if ($pk['package']) { $app = Application::getFacadeApplication(); $pkg = $app->make(PackageService::class)->getByHandle($pk['package']); } else { $pkg = null; } return self::add( $p...
php
{ "resource": "" }
q23459
Key.getByID
train
public static function getByID($pkID) { $keys = null; $app = Application::getFacadeApplication(); $cache = $app->make('cache/request'); if ($cache->isEnabled()) {
php
{ "resource": "" }
q23460
Key.getByHandle
train
public static function getByHandle($pkHandle) { $keys = null; $app = Application::getFacadeApplication(); $cache = $app->make('cache/request'); if ($cache->isEnabled()) {
php
{ "resource": "" }
q23461
Key.add
train
public static function add($pkCategoryHandle, $pkHandle, $pkName, $pkDescription, $pkCanTriggerWorkflow, $pkHasCustomClass, $pkg = false) { $app = Application::getFacadeApplication(); $db = $app->make(Connection::class); $pkCategoryID = $db->fetchColumn('select pkCategoryID from PermissionK...
php
{ "resource": "" }
q23462
Key.delete
train
public function delete() { $app = Application::getFacadeApplication(); $db = $app->make(Connection::class); $db->executeQuery('delete
php
{ "resource": "" }
q23463
Key.getAccessListItems
train
public function getAccessListItems() { $obj = $this->getPermissionAccessObject(); if (!$obj) { return []; } $args = func_get_args(); switch (count($args)) { case 0: return $obj->getAccessListItems(); case 1: ...
php
{ "resource": "" }
q23464
Key.exportTranslations
train
public static function exportTranslations() { $translations = new Translations(); $categories = PermissionKeyCategory::getList(); foreach ($categories as $cat) { $permissions = static::getList($cat->getPermissionKeyCategoryHandle()); foreach ($permissions as $p) { ...
php
{ "resource": "" }
q23465
DefaultRuntime.boot
train
public function boot() { $booter = $this->getBooter(); if ($response = $booter->boot()) { $this->sendResponse($response);
php
{ "resource": "" }
q23466
ServiceManager.getService
train
public function getService($handle, $version = '') { $result = null; if ($this->has($handle)) { $key = $handle; $version = (string) $version; if ($version !== '') { $key .= "@$version"; } if (!isset($this->services[$key])) {...
php
{ "resource": "" }
q23467
ServiceManager.buildService
train
private function buildService($abstract, $version = '') { $resolved = null; if (is_string($abstract)) { // If it's a string, throw it at the IoC container $resolved = $this->app->make($abstract, array($version)); } elseif (is_callable($abstract)) { // If ...
php
{ "resource": "" }
q23468
ServiceManager.getAllServices
train
public function getAllServices() { $result = array(); foreach ($this->getExtensions() as
php
{ "resource": "" }
q23469
ServiceManager.getActiveServices
train
public function getActiveServices() { $active = array(); foreach ($this->getExtensions() as $handle) { $service = $this->getService($handle); $version = $service->getDetector()->detect(); if ($version !== null) {
php
{ "resource": "" }
q23470
LikeBuilder.getEscapeMap
train
protected function getEscapeMap() { if ($this->escapeMap === null) { $escapeMap = [ $this->anyCharacterWildcard => $this->escapeCharacter . $this->anyCharacterWildcard, $this->oneCharacterWildcard => $this->escapeCharacter . $this->oneCharacterWildcard, ...
php
{ "resource": "" }
q23471
LikeBuilder.escapeForLike
train
public function escapeForLike($string, $wildcardAtStart = true, $wildcardAtEnd = true) { if ($wildcardAtStart) { $result = $this->anyCharacterWildcard; } else { $result = ''; } $result .=
php
{ "resource": "" }
q23472
LikeBuilder.splitKeywordsForLike
train
public function splitKeywordsForLike($string, $wordSeparators = '\s', $addWildcards = true) { $result = null; if (is_string($string)) { $words = preg_split('/[' . $wordSeparators . ']+/ms',
php
{ "resource": "" }
q23473
BasicThumbnailer.returnThumbnailObjectFromResolver
train
private function returnThumbnailObjectFromResolver($obj, $maxWidth, $maxHeight, $crop
php
{ "resource": "" }
q23474
BasicThumbnailer.checkForThumbnailAndCreateIfNecessary
train
private function checkForThumbnailAndCreateIfNecessary($obj, $maxWidth, $maxHeight, $crop
php
{ "resource": "" }
q23475
ItemList.getResults
train
public function getResults() { $results = array(); $this->debugStart(); $executeResults = $this->executeGetResults();
php
{ "resource": "" }
q23476
ItemList.setNameSpace
train
public function setNameSpace($nameSpace) { $this->paginationPageParameter .= '_' . $nameSpace;
php
{ "resource": "" }
q23477
PhpDocGenerator.describeVar
train
public function describeVar($name, $value) { return $this->indentation . '/** @var ' . $this->getVarType($value) . ' '
php
{ "resource": "" }
q23478
PhpDocGenerator.describeVars
train
public function describeVars(array $vars, $sortByName = true) { $result = ''; if ($sortByName) { ksort($vars, SORT_NATURAL); } foreach ($vars as $name => $value) {
php
{ "resource": "" }
q23479
PhpDocGenerator.getVarType
train
protected function getVarType($var, $arrayLevel = 0) { $phpType = gettype($var); switch ($phpType) { case 'boolean': $result = 'bool'; break; case 'integer': $result = 'int'; break; case 'double': ...
php
{ "resource": "" }
q23480
Version.getByHandle
train
public static function getByHandle($handle) { $list = Type::getVersionList(); foreach ($list as $version) {
php
{ "resource": "" }
q23481
Version.shouldExistFor
train
public function shouldExistFor($imageWidth, $imageHeight, File $file = null) { $result = false; $imageWidth = (int) $imageWidth; $imageHeight = (int) $imageHeight; if ($imageWidth > 0 && $imageHeight > 0) { // We have both image dimensions $thumbnailWidth = (i...
php
{ "resource": "" }
q23482
CountryList.getCountries
train
public function getCountries() { if (!array_key_exists(Localization::activeLocale(), $this->countries)) { $this->loadCountries();
php
{ "resource": "" }
q23483
CountryList.getCountriesForLanguage
train
public function getCountriesForLanguage($languageCode, $languageStatuses = 'orfm') { $territories = []; foreach (\Punic\Territory::getTerritoriesForLanguage($languageCode) as $territory) { $territoryLanguages = \Punic\Territory::getLanguages($territory, $languageStatuses, true); ...
php
{ "resource": "" }
q23484
UserInterface.validateAction
train
protected function validateAction() { $token = (isset($this->validationToken)) ? $this->validationToken : get_class($this); if (!$this->app->make('token')->validate($token)) { $this->error->add($this->app->make('token')->getErrorMessage());
php
{ "resource": "" }
q23485
RouterUrlResolver.resolveRoute
train
private function resolveRoute($route_handle, $route_parameters) { $list = $this->getRouteList(); $generator = $this->getGenerator(); if ($route = $list->get($route_handle)) { if ($path =
php
{ "resource": "" }
q23486
GeolocationResult.setError
train
public function setError($code, $message = '', Exception $innerException = null) { if ($code == static::ERR_NONE && !$message && $innerException === null) { $this->errorCode = static::ERR_NONE; $this->errorMessage = ''; $this->innerException = null; } else { ...
php
{ "resource": "" }
q23487
GeolocationResult.setLatitude
train
public function setLatitude($value) { if (is_float($value) || is_int($value) || (is_string($value) && is_numeric($value))) { $this->latitude = (float)
php
{ "resource": "" }
q23488
GeolocationResult.setLongitude
train
public function setLongitude($value) { if (is_float($value) || is_int($value) || (is_string($value) && is_numeric($value))) { $this->longitude = (float)
php
{ "resource": "" }
q23489
GeolocationResult.hasData
train
public function hasData() { return $this->countryCode !== '' || $this->countryName !== '' || $this->stateProvinceCode !== '' || $this->stateProvinceName !== '' || $this->cityName !== '' ||...
php
{ "resource": "" }
q23490
File.getDestinationFolder
train
protected function getDestinationFolder() { if ($this->destinationFolder === false) { $replacingFile = $this->getFileToBeReplaced(); if ($replacingFile !== null) { $folder = $replacingFile->getFileFolderObject(); } else { $treeNodeID = $thi...
php
{ "resource": "" }
q23491
File.downloadRemoteURL
train
protected function downloadRemoteURL($url, $temporaryDirectory) { $client = $this->app->make('http/client'); $request = $client->getRequest()->setUri($url); $response = $client->send(); if (!$response->isSuccess()) { throw new UserMessageException(t(/*i18n: %1$s is an URL...
php
{ "resource": "" }
q23492
Package.shouldEnableLegacyNamespace
train
public function shouldEnableLegacyNamespace() { if (isset($this->pkgAutoloaderMapCoreExtensions) && $this->pkgAutoloaderMapCoreExtensions) { // We're no longer using this to denote non-legacy applications, but if a package uses this
php
{ "resource": "" }
q23493
Package.getDatabaseConfig
train
public function getDatabaseConfig() { if (!$this->config) { $this->config
php
{ "resource": "" }
q23494
Package.getFileConfig
train
public function getFileConfig() { if (!$this->fileConfig) { $this->fileConfig
php
{ "resource": "" }
q23495
Package.getPackagePath
train
public function getPackagePath() { $packageHandle = $this->getPackageHandle(); $result = $this->DIR_PACKAGES . '/' . $packageHandle; if (!is_dir($result)) {
php
{ "resource": "" }
q23496
Package.getRelativePath
train
public function getRelativePath() { $packageHandle = $this->getPackageHandle(); if (is_dir($this->DIR_PACKAGES . '/' . $packageHandle)) { $result = $this->REL_DIR_PACKAGES . '/' . $packageHandle; } else {
php
{ "resource": "" }
q23497
Package.getChangelogContents
train
public function getChangelogContents() { $prefix = $this->getPackagePath() . '/'; foreach (['CHANGELOG', 'CHANGELOG.txt', 'CHANGELOG.md'] as $name) { $file = $prefix . $name; if (is_file($file)) {
php
{ "resource": "" }
q23498
Package.backup
train
public function backup() { $packageHandle = $this->getPackageHandle(); $errors = $this->app->make('error'); if ($packageHandle === '' || !is_dir(DIR_PACKAGES . '/' . $packageHandle)) { $errors->add($this->getErrorText(self::E_PACKAGE_NOT_FOUND)); } else { $con...
php
{ "resource": "" }
q23499
Package.installDB
train
public static function installDB($xmlFile) { if (file_exists($xmlFile)) { $app = ApplicationFacade::getFacadeApplication(); $db = $app->make(Connection::class); /* @var Connection $db */ $db->beginTransaction(); $parser = Schema::getSchemaParser(s...
php
{ "resource": "" }