Return the php-resque executable file

Maintain backward compatibility, as newer version of
php-resque has that file in another location

@param String $base Php-resque folder path

@since  1.1.6
@return String Relative path to php-resque executable file
348701
protected function getResqueBinFile($base)
    {
        $paths = array(
            'bin' . DS . 'resque',
            'bin' . DS . 'resque.php',
            'resque.php'
        );

        foreach ($paths as $path) {
            if (file_exists($base . DS . $path)) {
                return '.' . DS . $path;
            }
        }
        return '.' . DS . 'resque.php';
    }
387460
public function getBasePath() : string
    {
        $baseUri = $this->getBase();
        $path = ltrim($this->getPath(), "/");

        $absoluteUri = $baseUri . (($path === "") ? "" : "/" . $path);

        return $absoluteUri;
    }
704882
public function load($baseName) 
    {     
        $langFile = "{$this->dir}/{$this->locale}/{$baseName}.php";

        if (!is_file($langFile)) {
            return $this->langs;
        }
        
        $langs = include_once $langFile;
        if ($langs && is_array($langs)) {
            $this->langs = array_merge_recursive($this->langs, $langs);
        }
        
        return $this->langs;
    }
193679
public function basePath($basePath = null)
    {
        if (null === $basePath) {
            return $this->basePath;
        }

        $this->basePath = $basePath;
        return $this;
    }
812651
protected function absolutePath(string $file, string $base): string
    {
        return $file[0] !== DIRECTORY_SEPARATOR && !str_contains($file, ':')
            ? $base . DIRECTORY_SEPARATOR . $file
            : $file;
    }
1205126
public function absolute($relativePath = null)
    {
        if ($this->isEmptyPath($relativePath)) {
            return $this->basePath;
        }

        if ($this->startsWithBasePath($relativePath)) {
            return $relativePath;
        }

        if (!$baseUrl = $this->getBaseUrl()) {
            return $this->basePath.'/'.trim($relativePath, '/');
        }

        if ($this->startsWithBaseUrl($relativePath)) {
            return $this->absolute($this->relative($relativePath));
        }

        return $this->basePath.'/'.trim($relativePath, '/');
    }
709767
protected function getPHPExecutable()
    {
        $validExecutable = false;
        $output = array();
        $exec = 'php';
        if ( !empty( $this->Options['php-exec'] ) )
        {
            $exec = $this->Options['php-exec'];
        }
        exec( $exec . ' -v', $output );

        if ( count( $output ) && strpos( $output[0], 'PHP' ) !== false )
        {
            $validExecutable = true;
            $this->Executable = $exec;
        }

        while( !$validExecutable )
        {
            $input = readline( 'Enter path to PHP-CLI executable ( or [q] to quit )' );
            if ( $input === 'q' )
            {
                $this->Script->shutdown( 0 );
            }

            exec( $input . ' -v', $output );

            if ( count( $output ) && strpos( $output[0], 'PHP' ) !== false )
            {
                $validExecutable = true;
                $this->Executable = $input;
            }
        }
    }
1003258
public function getBaseDir()
    {
        if (empty($this->baseDir)) {
            $this->baseDir = trim(str_replace('index.php', '', Server::get('SCRIPT_NAME')), '/');
        }

        return $this->baseDir;
    }
680110
public static function getBaseChar($base, $max = 64)
    {
        $base = (int) $base;
        if ($base < 2 || $base > $max || $base > 64) {
            throw new \InvalidArgumentException('Argument base is not valid, base 2 to 64 are supported');
        }

        if (!isset(static::$baseChars[$base])) {
            if ($base > 62) {
                static::$baseChars[$base] = ($base == 64) ? static::BASECHAR_64 : substr(static::BASECHAR_64, 0, $base);
            } elseif ($base > 36) {
                static::$baseChars[$base] = ($base == 62) ? static::BASECHAR_62 : substr(static::BASECHAR_62, 0, $base);
            } else {
                static::$baseChars[$base] = ($base == 36) ? static::BASECHAR_36 : substr(static::BASECHAR_36, 0, $base);
            }
        }

        return static::$baseChars[$base];
    }
626027
public function getModulePath($base = self::DEFAULT_SOURCE)
    {
        if ($base === self::DEFAULT_TARGET) {
            return $this->getPublicPath();
        } else {
            return $this->getPath();
        }
    }
257407
public function getRelativePath(File $base_dir) {
        return FileSystem::getFileSystem()->makePathRelative($this->file->getAbsoluteFile()->getParent(), $base_dir->getAbsolutePath()) . $this->file->getName();
    }
1123273
public function run($base = null)
    {
        if (empty($base)) {
            $base = PUBLIC_PATH;
        }

        // Check if the File dataobject has a "Filename" field.
        // If not, cannot migrate
        /** @skipUpgrade */
        if (!DB::get_schema()->hasField('File', 'Filename')) {
            return 0;
        }

        // Set max time and memory limit
        Environment::increaseTimeLimitTo();
        Environment::increaseMemoryLimitTo();

        // Loop over all files
        $processedCount = $migratedCount = 0;
        $originalState = null;
        if (class_exists(Versioned::class)) {
            $originalState = Versioned::get_reading_mode();
            Versioned::set_stage(Versioned::DRAFT);
        }

        $query = $this->getFileQuery();
        $total = $query->count();
        foreach ($query as $file) {
            // Bypass the accessor and the filename from the column
            $filename = $file->getField('Filename');

            $success = $this->migrateFile($base, $file, $filename);

            if ($processedCount % $this->config()->get('log_interval') === 0) {
                if ($this->logger) {
                    $this->logger->info("Iterated $processedCount out of $total files. Migrated $migratedCount files.");
                }
            }

            $processedCount++;
            if ($success) {
                $migratedCount++;
            }
        }
        if (class_exists(Versioned::class)) {
            Versioned::set_reading_mode($originalState);
        }
        return $migratedCount;
    }
868225
public function getBaseFolder( $path = null )
    {

        if ( $path ) {
            return sprintf( '%s/%s', $this->baseFolder, $path );
        }

        return $this->baseFolder;
    }
1308464
public function basePath(?string $basePath = null) {
        if ($basePath != null) {
            $this->basePath = $basePath;
        }
        return $this->basePath;
    }
628111
public function compile($lessFile, $basePath = null)
    {
        try {
            $basePath = $this->_prepareBasepath($basePath, dirname($lessFile));

            $cache = new Cache($this->_options);
            $cache->setFile($lessFile, $basePath);

            $isExpired = $cache->isExpired();
            $isForce   = $this->_options->get('force', false, 'bool');

            if ($isForce || $cache->isExpired()) {
                $result = $this->_driver->compile($lessFile, $basePath);
                $cache->save($result);
            }

            $isExpired = ($isForce) ? true : $isExpired;
            $return = [FS::clean($cache->getFile(), '/'), $isExpired];

        } catch (\Exception $e) {
            $message = 'Less error: ' . $e->getMessage();
            throw new Exception($message);
        }

        return $return;
    }
540945
public static function getTempFolder($base)
    {
        $parent = static::getTempParentFolder($base);

        // The actual temp folder is a subfolder of getTempParentFolder(), named by username
        $subfolder = Path::join($parent, static::getTempFolderUsername());

        if (!@file_exists($subfolder)) {
            mkdir($subfolder);
        }

        return $subfolder;
    }
842693
static function find_file($file, $base = '/')
	{
		if(file_exists($file) && is_readable($file))
			return $file;

		foreach(bors_dirs() as $dir)
			if(file_exists($fn = $dir.$base.'/'.$file) && is_readable($fn))
				return $fn;

		return NULL;
	}