Skip to content

Instantly share code, notes, and snippets.

@NBZ4live
Created October 2, 2017 12:19
Show Gist options
  • Save NBZ4live/8ed860443a3df6fc5115ed088ca97ce0 to your computer and use it in GitHub Desktop.
Save NBZ4live/8ed860443a3df6fc5115ed088ca97ce0 to your computer and use it in GitHub Desktop.
WoltlabSuiteValetDriver

Installation

  1. Copy the WoltlabSuiteValetDriver.php to ~/.valet/Drivers
  2. Enter directory with installation files
  3. Use valet link wbb
  4. Directory will be accessible as wbb.dev
<?php
class WoltlabSuiteValetDriver extends BasicValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return bool
*/
public function serves($sitePath, $siteName, $uri)
{
if (file_exists($sitePath.'/WCFSetup.tar.gz')) {
return true;
}
$appConfigFile = $sitePath.'/app.config.inc.php';
if (file_exists($appConfigFile) && strpos(file_get_contents($appConfigFile), 'woltlab')) {
return true;
}
return false;
}
/**
* Determine if the incoming request is for a static file.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return string|false
*/
public function isStaticFile($sitePath, $siteName, $uri)
{
$staticFilePath = $sitePath.$uri;
if (file_exists($staticFilePath) &&
!is_dir($staticFilePath) &&
pathinfo($staticFilePath)['extension'] != 'php') {
return $staticFilePath;
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment