_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 83
13k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q258100 | Exif.getAuthor | test | public function getAuthor()
{
if (!isset($this->data[self::AUTHOR])) {
return false;
}
return $this->data[self::AUTHOR];
} | php | {
"resource": ""
} |
q258101 | Exif.getHeadline | test | public function getHeadline()
{
if (!isset($this->data[self::HEADLINE])) {
return false;
}
return $this->data[self::HEADLINE];
} | php | {
"resource": ""
} |
q258102 | Exif.getCredit | test | public function getCredit()
{
if (!isset($this->data[self::CREDIT])) {
return false;
}
return $this->data[self::CREDIT];
} | php | {
"resource": ""
} |
q258103 | Exif.getSource | test | public function getSource()
{
if (!isset($this->data[self::SOURCE])) {
return false;
}
return $this->data[self::SOURCE];
} | php | {
"resource": ""
} |
q258104 | Exif.getJobtitle | test | public function getJobtitle()
{
if (!isset($this->data[self::JOB_TITLE])) {
return false;
}
return $this->data[self::JOB_TITLE];
} | php | {
"resource": ""
} |
q258105 | Exif.getIso | test | public function getIso()
{
if (!isset($this->data[self::ISO])) {
return false;
}
return $this->data[self::ISO];
} | php | {
"resource": ""
} |
q258106 | Exif.getFocusDistance | test | public function getFocusDistance()
{
if (!isset($this->data[self::FOCAL_DISTANCE])) {
return false;
}
return $this->data[self::FOCAL_DISTANCE];
} | php | {
"resource": ""
} |
q258107 | Exif.getWidth | test | public function getWidth()
{
if (!isset($this->data[self::WIDTH])) {
return false;
}
return $this->data[self::WIDTH];
} | php | {
"resource": ""
} |
q258108 | Exif.getHeight | test | public function getHeight()
{
if (!isset($this->data[self::HEIGHT])) {
return false;
}
return $this->data[self::HEIGHT];
} | php | {
"resource": ""
} |
q258109 | Exif.getTitle | test | public function getTitle()
{
if (!isset($this->data[self::TITLE])) {
return false;
}
return $this->data[self::TITLE];
} | php | {
"resource": ""
} |
q258110 | Exif.getCaption | test | public function getCaption()
{
if (!isset($this->data[self::CAPTION])) {
return false;
}
return $this->data[self::CAPTION];
} | php | {
"resource": ""
} |
q258111 | Exif.getCopyright | test | public function getCopyright()
{
if (!isset($this->data[self::COPYRIGHT])) {
return false;
}
return $this->data[self::COPYRIGHT];
} | php | {
"resource": ""
} |
q258112 | Exif.getKeywords | test | public function getKeywords()
{
if (!isset($this->data[self::KEYWORDS])) {
return false;
}
return $this->data[self::KEYWORDS];
} | php | {
"resource": ""
} |
q258113 | Exif.getCamera | test | public function getCamera()
{
if (!isset($this->data[self::CAMERA])) {
return false;
}
return $this->data[self::CAMERA];
} | php | {
"resource": ""
} |
q258114 | Exif.getHorizontalResolution | test | public function getHorizontalResolution()
{
if (!isset($this->data[self::HORIZONTAL_RESOLUTION])) {
return false;
}
return $this->data[self::HORIZONTAL_RESOLUTION];
} | php | {
"resource": ""
} |
q258115 | Exif.getVerticalResolution | test | public function getVerticalResolution()
{
if (!isset($this->data[self::VERTICAL_RESOLUTION])) {
return false;
}
return $this->data[self::VERTICAL_RESOLUTION];
} | php | {
"resource": ""
} |
q258116 | Exif.getSoftware | test | public function getSoftware()
{
if (!isset($this->data[self::SOFTWARE])) {
return false;
}
return $this->data[self::SOFTWARE];
} | php | {
"resource": ""
} |
q258117 | Exif.getFocalLength | test | public function getFocalLength()
{
if (!isset($this->data[self::FOCAL_LENGTH])) {
return false;
}
return $this->data[self::FOCAL_LENGTH];
} | php | {
"resource": ""
} |
q258118 | Exif.getCreationDate | test | public function getCreationDate()
{
if (!isset($this->data[self::CREATION_DATE])) {
return false;
}
return $this->data[self::CREATION_DATE];
} | php | {
"resource": ""
} |
q258119 | Exif.getColorSpace | test | public function getColorSpace()
{
if (!isset($this->data[self::COLORSPACE])) {
return false;
}
return $this->data[self::COLORSPACE];
} | php | {
"resource": ""
} |
q258120 | Exif.getMimeType | test | public function getMimeType()
{
if (!isset($this->data[self::MIMETYPE])) {
return false;
}
return $this->data[self::MIMETYPE];
} | php | {
"resource": ""
} |
q258121 | Exif.getFileSize | test | public function getFileSize()
{
if (!isset($this->data[self::FILESIZE])) {
return false;
}
return $this->data[self::FILESIZE];
} | php | {
"resource": ""
} |
q258122 | Exif.getOrientation | test | public function getOrientation()
{
if (!isset($this->data[self::ORIENTATION])) {
return false;
}
return $this->data[self::ORIENTATION];
} | php | {
"resource": ""
} |
q258123 | Exif.getGPS | test | public function getGPS()
{
if (!isset($this->data[self::GPS])) {
return false;
}
return $this->data[self::GPS];
} | php | {
"resource": ""
} |
q258124 | Native.extractGPSCoordinate | test | protected function extractGPSCoordinate($components)
{
if (!is_array($components)) {
$components = array($components);
}
$components = array_map(array($this, 'normalizeComponent'), $components);
if (count($components) > 2) {
return floatval($components[0]) + (floatval($components[1]) / 60) + (floatval($components[2]) / 3600);
}
return reset($components);
} | php | {
"resource": ""
} |
q258125 | Exiftool.setToolPath | test | public function setToolPath($path)
{
if (!file_exists($path)) {
throw new InvalidArgumentException(
sprintf(
'Given path (%1$s) to the exiftool binary is invalid',
$path
)
);
}
$this->toolPath = $path;
return $this;
} | php | {
"resource": ""
} |
q258126 | Exiftool.getToolPath | test | public function getToolPath()
{
if (empty($this->toolPath)) {
$path = exec('which ' . self::TOOL_NAME);
$this->setToolPath($path);
}
return $this->toolPath;
} | php | {
"resource": ""
} |
q258127 | Exiftool.getCliOutput | test | protected function getCliOutput($command)
{
$descriptorspec = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'a')
);
$process = proc_open($command, $descriptorspec, $pipes);
if (!is_resource($process)) {
throw new RuntimeException(
'Could not open a resource to the exiftool binary'
);
}
$result = stream_get_contents($pipes[1]);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);
return $result;
} | php | {
"resource": ""
} |
q258128 | Mutator.hydrate | test | public function hydrate($object, array $data)
{
foreach ($data as $property => $value) {
$mutator = $this->determineMutator($property);
if (method_exists($object, $mutator)) {
$object->$mutator($value);
}
}
} | php | {
"resource": ""
} |
q258129 | Exiftool.extractGPSCoordinates | test | protected function extractGPSCoordinates($coordinates)
{
if ($this->numeric === true) {
return abs((float) $coordinates);
} else {
if (!preg_match('!^([0-9.]+) deg ([0-9.]+)\' ([0-9.]+)"!', $coordinates, $matches)) {
return false;
}
return floatval($matches[1]) + (floatval($matches[2]) / 60) + (floatval($matches[3]) / 3600);
}
} | php | {
"resource": ""
} |
q258130 | AdapterAbstract.getMapper | test | public function getMapper()
{
if (null === $this->mapper) {
// lazy load one
$mapper = new $this->mapperClass;
$this->setMapper($mapper);
}
return $this->mapper;
} | php | {
"resource": ""
} |
q258131 | AdapterAbstract.getHydrator | test | public function getHydrator()
{
if (null === $this->hydrator) {
// lazy load one
$hydrator = new $this->hydratorClass;
$this->setHydrator($hydrator);
}
return $this->hydrator;
} | php | {
"resource": ""
} |
q258132 | AdapterAbstract.setOptions | test | public function setOptions(array $options)
{
$hydrator = $this->getHydrator();
$hydrator->hydrate($this, $options);
return $this;
} | php | {
"resource": ""
} |
q258133 | Native.addRequiredSection | test | public function addRequiredSection($section)
{
if (!in_array($section, $this->requiredSections)) {
array_push($this->requiredSections, $section);
}
return $this;
} | php | {
"resource": ""
} |
q258134 | Native.getIptcData | test | public function getIptcData($file)
{
getimagesize($file, $info);
$arrData = array();
if (isset($info['APP13'])) {
$iptc = iptcparse($info['APP13']);
foreach ($this->iptcMapping as $name => $field) {
if (!isset($iptc[$field])) {
continue;
}
if (count($iptc[$field]) === 1) {
$arrData[$name] = reset($iptc[$field]);
} else {
$arrData[$name] = $iptc[$field];
}
}
}
return $arrData;
} | php | {
"resource": ""
} |
q258135 | Reader.factory | test | public static function factory($type)
{
$classname = get_called_class();
switch ($type) {
case self::TYPE_NATIVE:
$adapter = new NativeAdapter();
break;
case self::TYPE_EXIFTOOL:
$adapter = new ExiftoolAdapter();
break;
default:
throw new \InvalidArgumentException(
sprintf('Unknown type "%1$s"', $type)
);
}
return new $classname($adapter);
} | php | {
"resource": ""
} |
q258136 | AbstractStrategy._generatePrefix | test | protected function _generatePrefix()
{
$prefix = Inflector::underscore(Inflector::singularize($this->_table->getAlias()));
$prefix .= '_' . $this->_alias;
return strtoupper($prefix);
} | php | {
"resource": ""
} |
q258137 | EnumBehavior._normalizeConfig | test | protected function _normalizeConfig()
{
$classMap = $this->getConfig('classMap');
$this->_classMap = array_merge($this->_classMap, $classMap);
$lists = $this->getConfig('lists');
$defaultStrategy = $this->getConfig('defaultStrategy');
foreach ($lists as $alias => $config) {
if (is_numeric($alias)) {
unset($lists[$alias]);
$alias = $config;
$config = [];
$lists[$alias] = $config;
}
if (is_string($config)) {
$config = ['prefix' => strtoupper($config)];
}
if (empty($config['strategy'])) {
$config['strategy'] = $defaultStrategy;
}
$lists[$alias] = $this->strategy($alias, $config['strategy'])
->initialize($config)
->getConfig();
}
$this->setConfig('lists', $lists, false);
} | php | {
"resource": ""
} |
q258138 | EnumBehavior._translate | test | protected function _translate(array $list)
{
$domain = $this->getConfig('translationDomain');
return array_map(function ($value) use ($domain) {
return __d($domain, $value);
}, $list);
} | php | {
"resource": ""
} |
q258139 | StaticCacheFullBuildTask.run | test | public function run($request)
{
$job = new StaticCacheFullBuildJob();
$signature = $job->getSignature();
// see if we already have this job in a queue
$filter = [
'Signature' => $signature,
'JobStatus' => [
QueuedJob::STATUS_NEW,
QueuedJob::STATUS_INIT,
]
];
$existing = DataList::create(QueuedJobDescriptor::class)->filter($filter)->first();
if ($existing && $existing->ID) {
$this->log(sprintf(
'There is already a %s in the queue, added %s %s',
StaticCacheFullBuildJob::class,
$existing->Created,
$existing->StartAfter ? 'and set to start after ' . $existing->StartAfter : ''
));
return false;
}
if ($request->getVar('startAfter')) {
$now = DBDatetime::now();
$today = $now->Date();
$startTime = $request->getVar('startAfter');
// move to tomorrow if the starttime has passed today
if ($now->Time24() > $startTime) {
$timestamp = strtotime($today . ' ' . $startTime . ' +1 day');
$dayWord = 'tomorrow';
} else {
$timestamp = strtotime($today . ' ' . $startTime);
$dayWord = 'today';
}
$startAfter = (new \DateTime())->setTimestamp($timestamp);
$thisTimeTomorrow = (new \DateTime())->setTimestamp(strtotime($now . ' +1 day'))->getTimestamp();
// sanity check that we are in the next 24 hours - prevents some weird stuff sneaking through
if ($startAfter->getTimestamp() > $thisTimeTomorrow || $startAfter->getTimestamp() < $now->getTimestamp()) {
$this->log('Invalid startAfter parameter passed. Please ensure the time format is HHmm e.g. 1300');
return false;
}
$this->log(sprintf(
'%s queued for %s %s.',
StaticCacheFullBuildJob::class,
$startAfter->format('H:m'),
$dayWord
));
} else {
$startAfter = null;
$this->log(StaticCacheFullBuildJob::class . ' added to the queue for immediate processing');
}
$job->setJobData(0, 0, false, new \stdClass(), [
'Building static cache for full site'
]);
QueuedJobService::singleton()->queueJob($job, $startAfter ? $startAfter->format('Y-m-d H:i:s') : null);
return true;
} | php | {
"resource": ""
} |
q258140 | StaticCacheFullBuildJob.process | test | public function process()
{
$chunkSize = self::config()->get('chunk_size');
$count = 0;
// Remove any URLs which have already been processed
if ($this->jobData->ProcessedURLs) {
$this->jobData->URLsToProcess = array_diff_key(
$this->jobData->URLsToProcess,
$this->jobData->ProcessedURLs
);
}
foreach ($this->jobData->URLsToProcess as $url => $priority) {
if (++$count > $chunkSize) {
break;
}
$meta = Publisher::singleton()->publishURL($url, true);
if (!empty($meta['success'])) {
$this->jobData->ProcessedURLs[$url] = $url;
unset($this->jobData->URLsToProcess[$url]);
}
}
if (empty($this->jobData->URLsToProcess)) {
$trimSlashes = function ($value) {
return trim($value, '/');
};
$this->jobData->publishedURLs = array_map($trimSlashes, Publisher::singleton()->getPublishedURLs());
$this->jobData->ProcessedURLs = array_map($trimSlashes, $this->jobData->ProcessedURLs);
$this->jobData->URLsToCleanUp = array_diff($this->jobData->publishedURLs, $this->jobData->ProcessedURLs);
foreach ($this->jobData->URLsToCleanUp as $staleURL) {
$purgeMeta = Publisher::singleton()->purgeURL($staleURL);
if (!empty($purgeMeta['success'])) {
unset($this->jobData->URLsToCleanUp[$staleURL]);
}
}
};
$this->isComplete = empty($this->jobData->URLsToProcess) && empty($this->jobData->URLsToCleanUp);
} | php | {
"resource": ""
} |
q258141 | SiteTreePublishingEngine.collectChanges | test | public function collectChanges($context)
{
Environment::increaseMemoryLimitTo();
Environment::increaseTimeLimitTo();
if ($this->getOwner()->hasExtension(PublishableSiteTree::class)
|| $this->getOwner() instanceof StaticPublishingTrigger
) {
$toUpdate = $this->getOwner()->objectsToUpdate($context);
$this->setToUpdate($toUpdate);
$toDelete = $this->getOwner()->objectsToDelete($context);
$this->setToDelete($toDelete);
}
} | php | {
"resource": ""
} |
q258142 | SiteTreePublishingEngine.flushChanges | test | public function flushChanges()
{
$queue = QueuedJobService::singleton();
if (!empty($this->toUpdate)) {
foreach ($this->toUpdate as $queueItem) {
$job = Injector::inst()->create(GenerateStaticCacheJob::class);
$jobData = new \stdClass();
$urls = $queueItem->urlsToCache();
ksort($urls);
$jobData->URLsToProcess = $urls;
$job->setJobData(0, 0, false, $jobData, [
'Building URLs: ' . var_export(array_keys($jobData->URLsToProcess), true)
]);
$queue->queueJob($job);
}
$this->toUpdate = array();
}
if (!empty($this->toDelete)) {
foreach ($this->toDelete as $queueItem) {
$job = Injector::inst()->create(DeleteStaticCacheJob::class);
$jobData = new \stdClass();
$urls = $queueItem->urlsToCache();
ksort($urls);
$jobData->URLsToProcess = $urls;
$job->setJobData(0, 0, false, $jobData, [
'Purging URLs: ' . var_export(array_keys($jobData->URLsToProcess), true)
]);
$queue->queueJob($job);
}
$this->toDelete = array();
}
} | php | {
"resource": ""
} |
q258143 | ModuleExtensionCleanerDebug.getModuleExtensionsGarbage | test | protected function getModuleExtensionsGarbage($moduleMetaDataExtensions, $moduleInstalledExtensions)
{
$garbage = parent::getModuleExtensionsGarbage($moduleMetaDataExtensions, $moduleInstalledExtensions);
foreach ($moduleInstalledExtensions as $coreClassName => $listOfExtensions) {
foreach ($listOfExtensions as $extensions) {
if (! (isset($moduleMetaDataExtensions[$coreClassName]) && $moduleMetaDataExtensions[$coreClassName] == $extensions)) {
$garbage[$coreClassName][] = $extensions;
}
}
}
return $garbage;
} | php | {
"resource": ""
} |
q258144 | ModuleExtensionCleanerDebug.filterExtensionsByModule | test | protected function filterExtensionsByModule($modules, $module)
{
if ($this->isMetadataVersionGreaterEqual($module, '2.0')) {
$moduleHelper = Registry::get(ModuleHelper::class);
$moduleHelper->setModule($module);
$path = $moduleHelper->getModuleNameSpace();
} else {
$modulePaths = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aModulePaths');
$moduleId = $module->getId();
$path = '';
if (isset($modulePaths[$moduleId])) {
$path = $modulePaths[$moduleId] . '/';
}
if (!$path) {
$path = $moduleId . "/";
}
}
$filteredModules = [];
if (!$path) {
return $filteredModules;
}
foreach ($modules as $class => $extend) {
foreach ($extend as $extendPath) {
if (strpos($extendPath, $path) === 0) {
$filteredModules[$class][] = $extendPath;
}
}
}
return $filteredModules;
} | php | {
"resource": ""
} |
q258145 | InternalModule.getModuleBlocks | test | public function getModuleBlocks()
{
$config = Registry::getConfig();
$activeThemeIds = oxNew(\OxidEsales\Eshop\Core\Theme::class)->getActiveThemesList();
$activeThemeIds[] = '';
$themeIdsSql = join(', ', \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($activeThemeIds));
$aResults = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->select(
"SELECT OXID as id,
OXACTIVE as active,
OXTHEME as theme,
OXTEMPLATE as template,
OXBLOCKNAME as block,
OXFILE as file,
OXPOS
FROM oxtplblocks
WHERE oxModule = ? AND oxshopid = ? AND OXTHEME IN ($themeIdsSql)
ORDER BY OXTHEME, OXTEMPLATE, OXBLOCKNAME",
[$this->getId(), $config->getShopId()]
);
return $aResults->fetchAll();
} | php | {
"resource": ""
} |
q258146 | InternalModule.getModuleSettings | test | public function getModuleSettings()
{
$aResult = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->select(
'SELECT * FROM oxconfig WHERE oxModule = ? AND oxshopid = ?',
[sprintf('module:%s', $this->getId()), Registry::getConfig()->getShopId()]
);
return $aResult->fetchAll();
} | php | {
"resource": ""
} |
q258147 | InternalModule.isMetadataSupported | test | public function isMetadataSupported()
{
$sMetadataVersion = $this->getMetaDataVersion();
$sLatestVersion = '1.0';
if (method_exists('oxModuleList', 'getModuleVersions') || method_exists('oxModule', 'getModuleEvents')) {
$sLatestVersion = '1.1';
}
if (method_exists(ModuleList::class, 'getModuleConfigParametersByKey')) {
$sLatestVersion = '2.0';
}
if (method_exists(ModuleList::class, 'getSmartyPluginDirectories')) {
$sLatestVersion = '2.1';
}
return version_compare($sLatestVersion, $sMetadataVersion) >= 0;
} | php | {
"resource": ""
} |
q258148 | InternalModule.checkPhpFileExists | test | public function checkPhpFileExists($sClassName)
{
if ($this->isMetadataVersionGreaterEqual('2.0')) {
$composerClassLoader = $this->getModuleHelper()->getAutoloader();
return $composerClassLoader->findFile($sClassName);
} else {
$sExtensionPath = $sClassName . '.php';
$res = $this->checkFileExists($sExtensionPath);
return $res;
}
} | php | {
"resource": ""
} |
q258149 | InternalModule.checkModuleVersions | test | public function checkModuleVersions()
{
$sDatabaseVersion = $this->getModuleEntries(ModuleList::MODULE_KEY_VERSIONS);
/**
* Set version for disabled module
*/
if (!count($sDatabaseVersion)) {
$iLang = \OxidEsales\Eshop\Core\Registry::getLang()->getTplLanguage();
$sDatabaseVersion = $this->getInfo("version", $iLang);
}
$aResult = $this->toResult(['version'=>$sDatabaseVersion]);
return $aResult;
} | php | {
"resource": ""
} |
q258150 | InternalModule.checkExtendedClasses | test | public function checkExtendedClasses()
{
$aMetadataExtend = $this->getInfo('extend');
$aMetadataExtend = is_array($aMetadataExtend) ? $aMetadataExtend : [];
$aResult = [];
/**
* only convert class names to lower if we don't use namespace
*/
if (!$this->isMetadataVersionGreaterEqual('2.0')) {
$aMetadataExtend = array_change_key_case($aMetadataExtend, CASE_LOWER);
//convert legacy classnames because $aAllModules dos not contain legacy classes
if (method_exists(Registry::class ,'getBackwardsCompatibilityClassMap')) {
$map = Registry::getBackwardsCompatibilityClassMap();
foreach ($aMetadataExtend as $legacyName => $file) {
if (isset($map[$legacyName])) {
$namespaceName = $map[$legacyName];
$aMetadataExtend[$namespaceName] = $file;
unset($aMetadataExtend[$legacyName]);
}
}
}
}
foreach ($aMetadataExtend as $sClassName => $sModuleName) {
$key_state = $iState = self::OK;
if (strpos($sClassName,'OxidEsales\\EshopCommunity\\') === 0 ||
strpos($sClassName,'OxidEsales\\EshopEnterprise\\') === 0 ||
strpos($sClassName,'OxidEsales\\EshopProfessional\\') === 0 ||
!class_exists($sClassName)
) {
if (strpos($sClassName,'oxerp') === 0) {
//AS ERP module does still use a own autoloader
//classes of oxerp will not be found with class_exists
$erp_dir = Registry::getConfig()->getModulesDir() .'erp/';
if (strpos($sClassName,'oxerptype_') === 0) {
$dir = $erp_dir.'objects/';
} else {
$dir = $erp_dir;
}
$sFullPath = $dir.$sClassName.'.php';
if (!file_exists($sFullPath)) {
$key_state = self::SHOP_FILE_NOT_FOUND;
$this->state |= self::NEED_MANUAL_FIXED;
}
} else {
$key_state = self::SHOP_FILE_NOT_FOUND;
$this->state |= self::NEED_MANUAL_FIXED;
}
}
$aResult[ $sClassName ]['key_state'] = $key_state;
if (!$this->checkPhpFileExists($sModuleName)) {
$iState = self::MODULE_FILE_NOT_FOUND;
$this->state |= self::NEED_MANUAL_FIXED;
}
$aResult[ $sClassName ][ 'data' ] = $sModuleName;
$aResult[ $sClassName ][ 'state' ] = $iState;
}
return $aResult;
} | php | {
"resource": ""
} |
q258151 | InternalModule.checkTemplateBlocks | test | public function checkTemplateBlocks()
{
$sModulePath = $this->getModulePath();
$aDatabaseBlocks = $this->getModuleBlocks();
$aDatabaseBlocks = is_array($aDatabaseBlocks) ? $aDatabaseBlocks : [];
$aMetadataTemplates = $this->getInfo('templates');
$config = Registry::getConfig();
$sModulesDir = $config->getModulesDir();
// Check if all blocks are injected.
foreach ($aDatabaseBlocks as &$aBlock) {
$iState = self::OK;
$file = $aBlock['file'];
if (!$this->checkFileExists( $sModulePath . '/' . $file) &&
!$this->checkFileExists( $sModulePath . '/out/blocks/' . basename($file)) &&
!$this->checkFileExists( $sModulePath . '/out/blocks/' . basename($file) . '.tpl')
) {
$iState = self::MODULE_FILE_NOT_FOUND;
$this->state |= self::NEED_MANUAL_FIXED;
}
$block = $aBlock['block'];
$template = $aBlock['template'];
$aBlock['state'] = $iState;
// Check if template file exists and block is defined.
// Get template from shop..
$sTemplate = $config->getTemplatePath($template, false);
// Get template from shop admin ..
if (!$sTemplate) {
$sTemplate = $config->getTemplatePath($template, true);
}
// Get template from module ..
if (!$sTemplate && isset($aMetadataTemplates[$template])) {
if ($this->checkFileExists($aMetadataTemplates[$template])) {
$sTemplate = $sModulesDir . '/' . $aMetadataTemplates[$template];
}
}
if (empty($sTemplate)) {
$aBlock['t_state'] = self::SHOP_FILE_NOT_FOUND;
$this->state |= self::MAY_NEED_MANUAL_FIX;
} else {
$aBlock['t_state'] = self::OK;
$aBlock['b_state'] = self::OK;
$sContent = file_get_contents($sTemplate);
if (!preg_match('/\[{\s*block[^}]+?name\s*=\s*["\']' . $block . '[\'"].*?}\]/', $sContent)) {
$aBlock['b_state'] = self::SHOP_FILE_NOT_FOUND;
$this->state |= self::MAY_NEED_MANUAL_FIX;
}
}
}
return $aDatabaseBlocks;
} | php | {
"resource": ""
} |
q258152 | InternalModule.checkModuleSettings | test | public function checkModuleSettings()
{
$aDatabaseSettings = $this->getModuleSettings();
$aDatabaseSettings = is_array($aDatabaseSettings) ? $aDatabaseSettings : [];
$list = [];
foreach ($aDatabaseSettings as $v) {
$list[$v['OXVARNAME']] = $v['OXVARTYPE'];
}
$aResult = $this->toResult($list);
return $aResult;
} | php | {
"resource": ""
} |
q258153 | InternalModule.checkModuleTemplates | test | public function checkModuleTemplates()
{
$aDatabaseTemplates = $this->getModuleEntries(ModuleList::MODULE_KEY_TEMPLATES);
$aResult = $this->checkFiles($aDatabaseTemplates, false);
return $aResult;
} | php | {
"resource": ""
} |
q258154 | InternalModule.checkModuleController | test | public function checkModuleController()
{
$oModuleStateFixer = Registry::get(ModuleStateFixer::class);
$controllers = $oModuleStateFixer->getModuleControllerEntries($this->getId());
return $this->checkFiles($controllers, true);
} | php | {
"resource": ""
} |
q258155 | InternalModule.checkModuleFiles | test | public function checkModuleFiles()
{
$aDatabaseFiles = $this->getModuleEntries(ModuleList::MODULE_KEY_FILES);
return $this->checkFiles($aDatabaseFiles, false);
} | php | {
"resource": ""
} |
q258156 | InternalModule.checkModuleEvents | test | public function checkModuleEvents()
{
$aDatabaseEvents = $this->getModuleEntries(ModuleList::MODULE_KEY_EVENTS);
$aDatabaseEvents = is_array($aDatabaseEvents) ? $aDatabaseEvents : [];
$aDatabaseEvents = array_map(function ($value){return print_r($value,true);}, $aDatabaseEvents);
$aResult = $this->toResult($aDatabaseEvents);
foreach ($aResult as $eventName => &$data){
$data['key_state'] = ($eventName == 'onActivate' || $eventName == 'onDeactivate') ? self::OK : self::SHOP_FILE_NOT_FOUND;
}
return $aResult;
} | php | {
"resource": ""
} |
q258157 | ModuleFixCommand._parseModuleIds | test | protected function _parseModuleIds()
{
if ($this->input->getOption('all')) {
return $this->_getAvailableModuleIds();
}
if (count($this->input->getArguments()['module-id']) === 0) {
throw oxNew(
InputException::class,
'Please specify at least one module if as argument or use --all (-a) option'
);
}
$requestedModuleIds = $this->input->getArguments()['module-id'];
$availableModuleIds = $this->_getAvailableModuleIds();
// Checking if all provided module ids exist
foreach ($requestedModuleIds as $moduleId) {
if (!in_array($moduleId, $availableModuleIds)) {
throw oxNew(
InputException::class,
"{$moduleId} module does not exist"
);
}
}
return $requestedModuleIds;
} | php | {
"resource": ""
} |
q258158 | ModuleFixCommand._parseShopConfigs | test | protected function _parseShopConfigs()
{
if ($this->input->getOption('base-shop')) {
return array(Registry::getConfig());
}
if ($shopId = $this->input->getOption('shop')) {
if ($oConfig = ShopConfig::get($shopId)) {
return array($oConfig);
}
throw oxNew(
InputException::class,
'Shop id does not exist'
);
}
return ShopConfig::getAll();
} | php | {
"resource": ""
} |
q258159 | ModuleFixCommand._getAvailableModuleIds | test | protected function _getAvailableModuleIds()
{
if ($this->_aAvailableModuleIds === null) {
$oConfig = Registry::getConfig();
// We are calling getModulesFromDir() because we want to refresh
// the list of available modules. This is a workaround for OXID
// bug.
oxNew(ModuleList::class)->getModulesFromDir($oConfig->getModulesDir());
$this->_aAvailableModuleIds = array_keys($oConfig->getConfigParam('aModulePaths'));
}
return $this->_aAvailableModuleIds;
} | php | {
"resource": ""
} |
q258160 | ModuleFixCommand.isEnabled | test | public function isEnabled()
{
$app = $this->getApplication();
if (method_exists($app,'bootstrapOxid') ) {
return $app->bootstrapOxid(true);
}
return true;
} | php | {
"resource": ""
} |
q258161 | UtilsController.getModule | test | public function getModule()
{
if ($this->_oModule === null) {
$sModuleId = $this->getEditObjectId();
$this->addTplParam('oxid', $sModuleId);
$this->_oModule = oxNew(Module::class);
$this->_oModule->load($sModuleId);
}
return $this->_oModule;
} | php | {
"resource": ""
} |
q258162 | UtilsController.getModuleCache | test | public function getModuleCache()
{
if ($this->_oModuleCache === null) {
$this->_oModuleCache = oxNew(ModuleCache::class, $this->getModule());
}
return $this->_oModuleCache;
} | php | {
"resource": ""
} |
q258163 | UtilsController.getModuleInstaller | test | public function getModuleInstaller()
{
if ($this->_oModuleInstaller === null) {
$this->_oModuleInstaller = oxNew(ModuleInstaller::class, $this->getModuleCache());
}
return $this->_oModuleInstaller;
} | php | {
"resource": ""
} |
q258164 | ModuleStateFixer.fix | test | public function fix($module, $oConfig = null)
{
if ($oConfig !== null) {
$this->setConfig($oConfig);
}
$moduleId = $module->getId();
$this->needCacheClear = false;
if ($this->init()) {
$this->module = $module;
$this->restoreModuleInformation($module, $moduleId);
}
$somethingWasFixed = $this->needCacheClear;
$this->clearCache($module);
return $somethingWasFixed;
} | php | {
"resource": ""
} |
q258165 | ModuleStateFixer.cleanUpExtensions | test | public function cleanUpExtensions(){
//get all extions from all metadata
$oxModuleList = $this->moduleList;
$aModules = $oxModuleList->getList();
//get extensions from metadata file
$moduleClassesMf = [];
foreach ($aModules as $module) {
$extensions = $module->getExtensions();
foreach ($extensions as $moduleClass) {
$moduleClassesMf[$moduleClass] = 1;
}
}
//get all extesions from db
$extensionChainDb = Registry::getConfig()->getConfigParam('aModules');
$extensionChainDb = $oxModuleList->parseModuleChains($extensionChainDb);
//calculate trash as extensions that are only in db
foreach ($extensionChainDb as $oxidClass => &$arrayOfExtendingClasses) {
foreach ($arrayOfExtendingClasses as $key => $extendingClass){
if (!isset($moduleClassesMf[$extendingClass])) {
$this->output->warning("module extension trash found: '$extendingClass'' (registered for $oxidClass)");
unset($arrayOfExtendingClasses[$key]);
}
}
$arrayOfExtendingClasses = array_values($arrayOfExtendingClasses);
if (empty($arrayOfExtendingClasses)) {
unset($extensionChainDb[$oxidClass]);
}
}
if (!$this->dryRun) {
$extensionChainDb = $this->buildModuleChains($extensionChainDb);
$this->_saveToConfig('aModules', $extensionChainDb);
}
} | php | {
"resource": ""
} |
q258166 | ModuleStateFixer._addTemplateFiles | test | protected function _addTemplateFiles($aModuleTemplates, $sModuleId)
{
$aTemplates = (array) Registry::getConfig()->getConfigParam('aModuleTemplates');
$old = isset($aTemplates[$sModuleId]) ? $aTemplates[$sModuleId] : null;
if (is_array($aModuleTemplates)) {
$diff = $this->diff($old,$aModuleTemplates);
if ($diff) {
$what = $old === null ? ' everything ' : var_export($diff, true);
$this->output->warning("$sModuleId fixing templates");
$this->output->debug(" $what");
$aTemplates[$sModuleId] = $aModuleTemplates;
$this->_saveToConfig('aModuleTemplates', $aTemplates);
$this->needCacheClear = true;
}
} else {
if ($old) {
$this->output->warning("$sModuleId unregister templates:");
$this->_deleteTemplateFiles($sModuleId);
$this->needCacheClear = true;
}
}
} | php | {
"resource": ""
} |
q258167 | ModuleStateFixer._addModuleFiles | test | protected function _addModuleFiles($aModuleFiles, $sModuleId)
{
$aFiles = (array) Registry::getConfig()->getConfigParam('aModuleFiles');
$old = isset($aFiles[$sModuleId]) ? $aFiles[$sModuleId] : null;
if ($aModuleFiles !== null) {
$aModuleFiles = array_change_key_case($aModuleFiles, CASE_LOWER);
}
if (is_array($aModuleFiles)) {
$diff = $this->diff($old,$aModuleFiles);
if ($diff) {
$what = $old === null ? ' everything' : var_export($diff, true);
$this->output->warning("$sModuleId fixing files");
$this->output->debug(" $what");
$aFiles[$sModuleId] = $aModuleFiles;
$this->_saveToConfig('aModuleFiles', $aFiles);
$this->needCacheClear = true;
}
} else {
if ($old) {
$this->output->warning("$sModuleId unregister files");
$this->_deleteModuleFiles($sModuleId);
$this->needCacheClear = true;
}
}
} | php | {
"resource": ""
} |
q258168 | ModuleStateFixer._addModuleEvents | test | protected function _addModuleEvents($aModuleEvents, $sModuleId)
{
$aEvents = (array) Registry::getConfig()->getConfigParam('aModuleEvents');
$old = isset($aEvents[$sModuleId]) ? $aEvents[$sModuleId] : null;
if (is_array($aModuleEvents) && count($aModuleEvents)) {
$diff = $this->diff($old,$aModuleEvents);
if ($diff) {
$aEvents[$sModuleId] = $aModuleEvents;
$what = $old == null ? ' everything ' : var_export($diff, true);
$this->output->warning("$sModuleId fixing module events");
$this->output->debug(" $what");
$this->_saveToConfig('aModuleEvents', $aEvents);
$this->needCacheClear = true;
}
} else {
if ($old) {
$this->output->info("$sModuleId unregister events");
$this->_deleteModuleEvents($sModuleId);
$this->needCacheClear = true;
}
}
} | php | {
"resource": ""
} |
q258169 | ModuleStateFixer._addModuleExtensions | test | protected function _addModuleExtensions($moduleExtensions, $moduleId)
{
$extensions = (array) Registry::getConfig()->getConfigParam('aModuleExtensions');
$old = isset($extensions[$moduleId]) ? $extensions[$moduleId] : null;
$old = (array) $old;
$new = $moduleExtensions === null ? [] : array_values($moduleExtensions);
if (is_array($moduleExtensions)) {
$diff = $this->diff($old, $new);
if ($diff) {
$extensions[$moduleId] = array_values($moduleExtensions);
$what = $old === null ? ' everything ' : var_export($diff, true);
$this->output->warning("$moduleId fixing module extensions");
$this->output->debug(" $what");
$this->_saveToConfig('aModuleExtensions', $extensions);
$this->needCacheClear = true;
}
} else {
$this->output->warning("$moduleId unregister module extensions");
$this->needCacheClear = true;
$this->_saveToConfig('aModuleExtensions', []);
}
} | php | {
"resource": ""
} |
q258170 | ModuleStateFixer._addModuleVersion | test | protected function _addModuleVersion($sModuleVersion, $sModuleId)
{
$aVersions = (array) Registry::getConfig()->getConfigParam('aModuleVersions');
$old = isset($aVersions[$sModuleId]) ? $aVersions[$sModuleId] : '';
if (isset($sModuleVersion)) {
if ($old !== $sModuleVersion) {
$aVersions[$sModuleId] = $sModuleVersion;
if($old == '') {
$this->output->info("register module '$sModuleId' with version $sModuleVersion");
} else {
$this->output->warning("$sModuleId fixing module version from $old to $sModuleVersion");
}
$this->_saveToConfig('aModuleVersions', $aVersions);
$this->needCacheClear = true;
}
} else {
if ($old) {
$this->output->info("$sModuleId unregister module version");
$this->_deleteModuleVersions($sModuleId);
$this->needCacheClear = true;
}
}
} | php | {
"resource": ""
} |
q258171 | ModuleStateFixer.diff | test | protected function diff($array1,$array2){
if ($array1 === null) {
if ($array2 === null) {
return false; //indicate no diff
}
return $array2; //full array2 is new
}
if ($array2 === null) {
//indicate that diff is there (so return a true value) but everthing should be droped
return 'null';
}
$diff = array_merge(array_diff_assoc($array1,$array2),array_diff_assoc($array2,$array1));
return $diff;
} | php | {
"resource": ""
} |
q258172 | ModuleStateFixer._addModuleSettings | test | protected function _addModuleSettings($moduleSettings, $moduleId)
{
$config = Registry::getConfig();
$shopId = $config->getShopId();
if (is_array($moduleSettings)) {
$diff = false;
foreach ($moduleSettings as $setting) {
$module = $this->getModuleConfigId($moduleId);
$name = $setting["name"];
$type = $setting["type"];
if (isset($setting["value"]) && is_null($config->getConfigParam($name))){
$diff = true;
$value = $setting["value"];
$config->saveShopConfVar($type, $name, $value, $shopId, $module);
$this->output->debug("$moduleId: setting for '$name' fixed'");
} ;
}
if ($diff) {
$this->output->warning("$moduleId: settings fixed'");
$this->needCacheClear = true;
}
}
} | php | {
"resource": ""
} |
q258173 | ModuleStateFixer.setModuleControllers | test | protected function setModuleControllers($moduleControllers, $moduleId, $module)
{
$controllersForThatModuleInDb = $this->getModuleControllerEntries($moduleId);
$diff = $this->diff($controllersForThatModuleInDb, $moduleControllers);
if ($diff) {
$shopId = Registry::getConfig()->getShopId();
$this->output->warning("in shop $shopId: $moduleId fixing module controllers");
$this->output->warning(" (in md):" . var_export($moduleControllers, true));
$this->output->warning(" (in db):" . var_export($controllersForThatModuleInDb, true));
$this->deleteModuleControllers($moduleId);
$this->resetModuleCache($module);
if ($moduleControllers) {
$this->validateModuleMetadataControllersOnActivation($moduleControllers);
$classProviderStorage = $this->getClassProviderStorage();
$classProviderStorage->add($moduleId, $moduleControllers);
}
$afterControllersForThatModuleInDb = $this->getModuleControllerEntries($moduleId);
$this->needCacheClear = true;
}
} | php | {
"resource": ""
} |
q258174 | ModuleStateFixer._addExtensions | test | protected function _addExtensions(\OxidEsales\Eshop\Core\Module\Module $module)
{
$needFix = $this->checkExtensions($module, $aModulesDefault, $aModules);
if ($needFix) {
$this->needCacheClear = true;
$onlyInAfterFix = array_diff($aModules, $aModulesDefault);
$onlyInBeforeFix = array_diff($aModulesDefault, $aModules);
$this->output->info("fixing " . $module->getId());
foreach ($onlyInAfterFix as $core => $ext) {
if ($oldChain = $onlyInBeforeFix[$core]) {
$newExt = substr($ext, strlen($oldChain));
if (!$newExt) {
//$newExt = substr($ext, strlen($oldChain));
$this->output->debug(" remove ext for $core");
$this->output->debug(" old: $oldChain");
$this->output->debug(" new: $ext");
//return;
continue;
} else {
$this->output->debug(" append $core => ...$newExt");
}
unset($onlyInBeforeFix[$core]);
} else {
$this->output->debug(" add $core => $ext");
}
}
foreach ($onlyInBeforeFix as $core => $ext) {
$this->output->debug(" remove $core => $ext");
}
$this->_saveToConfig('aModules', $aModules);
}
} | php | {
"resource": ""
} |
q258175 | OxidComposerModulesService.getList | test | public function getList(){
if ($this->list !== null){
return $this->list;
}
$list = [];
$packages = $this->getOxidModulePackages();
//$moduleList = Registry::get(ModuleList::class);
//$pathList = $moduleList->getModuleConfigParametersByKey(ModuleList::MODULE_KEY_PATHS);
//$path2Id = array_flip($pathList);
$config = Registry::getConfig();
$paths = $config->getConfigParam('aModulePaths');
$path2id = array_flip($paths);
foreach ($packages as $package) {
$extra = $package->getExtra();
$oxideshop = isset($extra['oxideshop']) ? $extra['oxideshop'] : [];
if (isset($oxideshop['target-directory'])) {
$id = $path2id[$oxideshop['target-directory']];
$list[$id] = $package;
}
}
$this->list = $list;
return $list;
} | php | {
"resource": ""
} |
q258176 | State.render | test | public function render()
{
//valid for all metadata versions
$module = $this->getModule();
$state = $module->checkState();
foreach ($state as $paramName => $paramValue) {
$this->addTplParam($paramName, $paramValue);
}
return $this->sTemplate;
} | php | {
"resource": ""
} |
q258177 | State.block | test | public function block()
{
$request = Registry::getRequest();
$data = $request->getRequestParameter('data');
DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC)->execute(
"UPDATE oxtplblocks SET OXACTIVE = NOT OXACTIVE WHERE OXID = ?",[$data]);
} | php | {
"resource": ""
} |
q258178 | HttpFactory.getHttp | test | public static function getHttp($options = array(), $adapters = null)
{
if (!\is_array($options) && !($options instanceof \ArrayAccess))
{
throw new \InvalidArgumentException(
'The options param must be an array or implement the ArrayAccess interface.'
);
}
if (!$driver = self::getAvailableDriver($options, $adapters))
{
throw new \RuntimeException('No transport driver available.');
}
return new Http($options, $driver);
} | php | {
"resource": ""
} |
q258179 | HttpFactory.getAvailableDriver | test | public static function getAvailableDriver($options = array(), $default = null)
{
if (!\is_array($options) && !($options instanceof \ArrayAccess))
{
throw new \InvalidArgumentException(
'The options param must be an array or implement the ArrayAccess interface.'
);
}
if ($default === null)
{
$availableAdapters = self::getHttpTransports();
}
else
{
settype($default, 'array');
$availableAdapters = $default;
}
// Check if there is at least one available http transport adapter
if (!\count($availableAdapters))
{
return false;
}
foreach ($availableAdapters as $adapter)
{
/** @var $class TransportInterface */
$class = 'Joomla\\Http\\Transport\\' . ucfirst($adapter);
if (class_exists($class))
{
if ($class::isSupported())
{
return new $class($options);
}
}
}
return false;
} | php | {
"resource": ""
} |
q258180 | HttpFactory.getHttpTransports | test | public static function getHttpTransports()
{
$names = array();
$iterator = new \DirectoryIterator(__DIR__ . '/Transport');
/** @var $file \DirectoryIterator */
foreach ($iterator as $file)
{
$fileName = $file->getFilename();
// Only load for php files.
if ($file->isFile() && $file->getExtension() == 'php')
{
$names[] = substr($fileName, 0, strrpos($fileName, '.'));
}
}
// Keep alphabetical order across all environments
sort($names);
// If curl is available set it to the first position
$key = array_search('Curl', $names);
if ($key)
{
unset($names[$key]);
array_unshift($names, 'Curl');
}
return $names;
} | php | {
"resource": ""
} |
q258181 | Curl.setCAOptionAndValue | test | protected function setCAOptionAndValue($ch)
{
if (isset($this->options['curl.certpath']))
{
// Option is passed to a .PEM file.
curl_setopt($ch, CURLOPT_CAINFO, $this->options['curl.certpath']);
return;
}
$caPathOrFile = CaBundle::getSystemCaRootBundlePath();
if (is_dir($caPathOrFile) || (is_link($caPathOrFile) && is_dir(readlink($caPathOrFile))))
{
curl_setopt($ch, CURLOPT_CAPATH, $caPathOrFile);
return;
}
curl_setopt($ch, CURLOPT_CAINFO, $caPathOrFile);
} | php | {
"resource": ""
} |
q258182 | Curl.getResponse | test | protected function getResponse($content, $info)
{
// Create the response object.
$return = new Response;
// Try to get header size
if (isset($info['header_size']))
{
$headerString = trim(substr($content, 0, $info['header_size']));
$headerArray = explode("\r\n\r\n", $headerString);
// Get the last set of response headers as an array.
$headers = explode("\r\n", array_pop($headerArray));
// Set the body for the response.
$return->body = substr($content, $info['header_size']);
}
// Fallback and try to guess header count by redirect count
else
{
// Get the number of redirects that occurred.
$redirects = isset($info['redirect_count']) ? $info['redirect_count'] : 0;
/*
* Split the response into headers and body. If cURL encountered redirects, the headers for the redirected requests will
* also be included. So we split the response into header + body + the number of redirects and only use the last two
* sections which should be the last set of headers and the actual body.
*/
$response = explode("\r\n\r\n", $content, 2 + $redirects);
// Set the body for the response.
$return->body = array_pop($response);
// Get the last set of response headers as an array.
$headers = explode("\r\n", array_pop($response));
}
// Get the response code from the first offset of the response headers.
preg_match('/[0-9]{3}/', array_shift($headers), $matches);
$code = \count($matches) ? $matches[0] : null;
if (is_numeric($code))
{
$return->code = (int) $code;
}
// No valid response code was detected.
else
{
throw new InvalidResponseCodeException('No HTTP response code found.');
}
// Add the response headers to the response object.
foreach ($headers as $header)
{
$pos = strpos($header, ':');
$return->headers[trim(substr($header, 0, $pos))] = trim(substr($header, ($pos + 1)));
}
return $return;
} | php | {
"resource": ""
} |
q258183 | Curl.redirectsAllowed | test | private function redirectsAllowed()
{
// There are no issues on PHP 5.6 and later
if (version_compare(PHP_VERSION, '5.6', '>='))
{
return true;
}
// For PHP 5.3, redirects are not allowed if safe_mode and open_basedir are enabled
if (PHP_MAJOR_VERSION === 5 && PHP_MINOR_VERSION === 3)
{
if (!ini_get('safe_mode') && !ini_get('open_basedir'))
{
return true;
}
}
// For PHP 5.4 and 5.5, we only need to check if open_basedir is disabled
return !ini_get('open_basedir');
} | php | {
"resource": ""
} |
q258184 | Http.options | test | public function options($url, array $headers = array(), $timeout = null)
{
return $this->makeTransportRequest('OPTIONS', $url, null, $headers, $timeout);
} | php | {
"resource": ""
} |
q258185 | Http.head | test | public function head($url, array $headers = array(), $timeout = null)
{
return $this->makeTransportRequest('HEAD', $url, null, $headers, $timeout);
} | php | {
"resource": ""
} |
q258186 | Http.trace | test | public function trace($url, array $headers = array(), $timeout = null)
{
return $this->makeTransportRequest('TRACE', $url, null, $headers, $timeout);
} | php | {
"resource": ""
} |
q258187 | Http.patch | test | public function patch($url, $data, array $headers = array(), $timeout = null)
{
return $this->makeTransportRequest('PATCH', $url, $data, $headers, $timeout);
} | php | {
"resource": ""
} |
q258188 | AbstractGlobMatcher.match | test | public function match($relativePath, $globExpression)
{
if (!is_string($globExpression) && !is_null($globExpression)) {
$message = "Given value \"$globExpression\" is not a valid glob expression. ".
"Valid expression must be a string e.g. \"*.txt\".";
throw new InvalidArgumentException($message);
}
if (Path::isAbsolute((string)$globExpression)) {
$message = "Given value \"$globExpression\" is an absolute path. ".
"Glob expression can only be accepted if it's a relative path.";
throw new InvalidArgumentException($message);
}
if (is_null($globExpression)) {
return true;
}
return static::isGlobMatch($relativePath, $globExpression);
} | php | {
"resource": ""
} |
q258189 | AbstractPackageInstaller.getExtraParameterValueByKey | test | protected function getExtraParameterValueByKey($extraParameterKey, $defaultValue = null)
{
$extraParameters = $this->getPackage()->getExtra();
$extraParameterValue = $extraParameters[static::EXTRA_PARAMETER_KEY_ROOT][$extraParameterKey] ?? null;
return (!empty($extraParameterValue)) ? $extraParameterValue : $defaultValue;
} | php | {
"resource": ""
} |
q258190 | AbstractPackageInstaller.getCombinedFilters | test | protected function getCombinedFilters($listOfGlobExpressionLists)
{
$filters = [];
foreach ($listOfGlobExpressionLists as $filter) {
$filters = array_merge($filters, $filter);
}
return $filters;
} | php | {
"resource": ""
} |
q258191 | Plugin.activate | test | public function activate(Composer $composer, IOInterface $io)
{
$packageInstallerTrigger = new PackageInstallerTrigger($io, $composer);
$composer->getInstallationManager()->addInstaller($packageInstallerTrigger);
$this->composer = $composer;
$this->io = $io;
$this->packageInstallerTrigger = $packageInstallerTrigger;
$extraSettings = $this->composer->getPackage()->getExtra();
if (isset($extraSettings[AbstractPackageInstaller::EXTRA_PARAMETER_KEY_ROOT])) {
$this->packageInstallerTrigger->setSettings($extraSettings[AbstractPackageInstaller::EXTRA_PARAMETER_KEY_ROOT]);
}
} | php | {
"resource": ""
} |
q258192 | GlobListMatcher.matchAny | test | public function matchAny($relativePath, $globExpressionList)
{
if (!is_array($globExpressionList) && (!$globExpressionList instanceof \Traversable)
&& (!is_null($globExpressionList))) {
$message = "Given value \"$globExpressionList\" is not a valid glob expression list. ".
"Valid entry must be a list of glob expressions e.g. [\"*.txt\", \"*.pdf\"].";
throw new \InvalidArgumentException($message);
}
if (count($globExpressionList) > 0) {
return $this->isMatchInList($relativePath, $globExpressionList);
}
return false;
} | php | {
"resource": ""
} |
q258193 | GlobListMatcher.isMatchInList | test | private function isMatchInList($relativePath, $globExpressionList)
{
foreach ($globExpressionList as $globExpression) {
if ($this->globMatcher->match($relativePath, $globExpression)) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q258194 | PackageInstallerTrigger.getShopSourcePath | test | public function getShopSourcePath()
{
$shopSource = Path::join(getcwd(), ShopPackageInstaller::SHOP_SOURCE_DIRECTORY);
if (isset($this->settings[AbstractPackageInstaller::EXTRA_PARAMETER_SOURCE_PATH])) {
$shopSource = $this->settings[AbstractPackageInstaller::EXTRA_PARAMETER_SOURCE_PATH];
}
return $shopSource;
} | php | {
"resource": ""
} |
q258195 | PackageInstallerTrigger.createInstaller | test | protected function createInstaller(PackageInterface $package)
{
return new $this->installers[$package->getType()]($this->io, $this->getShopSourcePath(), $package);
} | php | {
"resource": ""
} |
q258196 | ShopPackageInstaller.install | test | public function install($packagePath)
{
$this->writeInstallingMessage($this->getPackageTypeDescription());
$this->writeCopyingMessage();
$this->copyPackage($packagePath);
$this->writeDoneMessage();
} | php | {
"resource": ""
} |
q258197 | ShopPackageInstaller.update | test | public function update($packagePath)
{
$this->writeUpdatingMessage($this->getPackageTypeDescription());
$question = 'All files in the following directories will be overwritten:' . PHP_EOL .
'- ' . $this->getTargetDirectoryOfShopSource() . PHP_EOL .
'Do you want to overwrite them? (y/N) ';
if ($this->askQuestionIfNotInstalled($question)) {
$this->writeCopyingMessage();
$this->copyPackage($packagePath);
$this->writeDoneMessage();
} else {
$this->writeSkippedMessage();
}
} | php | {
"resource": ""
} |
q258198 | ShopPackageInstaller.copyShopSourceFromPackageToTarget | test | private function copyShopSourceFromPackageToTarget($packagePath)
{
$filtersToApply = [
$this->getBlacklistFilterValue(),
[self::HTACCESS_FILTER],
[self::ROBOTS_EXCLUSION_FILTER],
[self::SETUP_FILES_FILTER],
$this->getVCSFilter(),
];
CopyGlobFilteredFileManager::copy(
$this->getPackageDirectoryOfShopSource($packagePath),
$this->getTargetDirectoryOfShopSource(),
$this->getCombinedFilters($filtersToApply)
);
} | php | {
"resource": ""
} |
q258199 | ShopPackageInstaller.copyConfigurationDistFileWithinTarget | test | private function copyConfigurationDistFileWithinTarget()
{
$pathToConfig = Path::join($this->getTargetDirectoryOfShopSource(), self::SHOP_SOURCE_CONFIGURATION_FILE);
$pathToConfigDist = $pathToConfig . self::DISTRIBUTION_FILE_EXTENSION_MARK;
$this->copyFileIfIsMissing($pathToConfigDist, $pathToConfig);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.