Updated installation, added links to troubleshooting
This commit is contained in:
parent
60cf21f414
commit
4924922d56
3 changed files with 20 additions and 18 deletions
|
@ -66,6 +66,10 @@ class YellowCore {
|
|||
$this->system->setDefault("coreSystemFile", "system.ini");
|
||||
$this->system->setDefault("coreTextFile", "text.ini");
|
||||
$this->system->setDefault("coreLogFile", "yellow.log");
|
||||
$troubleshooting = "<a href=\"https://datenstrom.se/yellow/help/troubleshooting\">See troubleshooting</a>.";
|
||||
extension_loaded("mbstring") || die("Datenstrom Yellow requires PHP mbstring extension! $troubleshooting");
|
||||
extension_loaded("curl") || die("Datenstrom Yellow requires PHP cURL extension! $troubleshooting");
|
||||
extension_loaded("zip") || die("Datenstrom Yellow requires PHP zip extension! $troubleshooting");
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
// This file may be used and distributed under the terms of the public license.
|
||||
|
||||
class YellowImage {
|
||||
const VERSION = "0.8.5";
|
||||
const VERSION = "0.8.6";
|
||||
const TYPE = "feature";
|
||||
public $yellow; //access to API
|
||||
public $graphicsLibrary; //graphics library support? (boolean)
|
||||
|
||||
// Handle initialisation
|
||||
public function onLoad($yellow) {
|
||||
|
@ -19,17 +18,14 @@ class YellowImage {
|
|||
$this->yellow->system->setDefault("imageThumbnailLocation", "/media/thumbnails/");
|
||||
$this->yellow->system->setDefault("imageThumbnailDir", "media/thumbnails/");
|
||||
$this->yellow->system->setDefault("imageThumbnailJpgQuality", "80");
|
||||
$this->graphicsLibrary = $this->isGraphicsLibrary();
|
||||
}
|
||||
$troubleshooting = "<a href=\"https://datenstrom.se/yellow/help/troubleshooting\">See troubleshooting</a>.";
|
||||
extension_loaded("gd") || die("Datenstrom Yellow requires PHP GD extension! $troubleshooting");
|
||||
extension_loaded("exif") || die("Datenstrom Yellow requires PHP Exif extension! $troubleshooting"); }
|
||||
|
||||
// Handle page content of shortcut
|
||||
public function onParseContentShortcut($page, $name, $text, $type) {
|
||||
$output = null;
|
||||
if ($name=="image" && $type=="inline") {
|
||||
if (!$this->graphicsLibrary) {
|
||||
$this->yellow->page->error(500, "Image extension requires GD library and EXIF library!");
|
||||
return $output;
|
||||
}
|
||||
list($name, $alt, $style, $width, $height) = $this->yellow->toolbox->getTextArgs($text);
|
||||
if (!preg_match("/^\w+:/", $name)) {
|
||||
if (empty($alt)) $alt = $this->yellow->system->get("imageAlt");
|
||||
|
@ -52,7 +48,7 @@ class YellowImage {
|
|||
|
||||
// Handle media file changes
|
||||
public function onEditMediaFile($file, $action) {
|
||||
if ($action=="upload" && $this->graphicsLibrary) {
|
||||
if ($action=="upload") {
|
||||
$fileName = $file->fileName;
|
||||
$fileType = $this->yellow->toolbox->getFileType($file->get("fileNameShort"));
|
||||
list($widthInput, $heightInput, $type) = $this->yellow->toolbox->detectImageInformation($fileName, $fileType);
|
||||
|
@ -273,9 +269,4 @@ class YellowImage {
|
|||
public function isFileNotUpdated($fileNameInput, $fileNameOutput) {
|
||||
return $this->yellow->toolbox->getFileModified($fileNameInput)!=$this->yellow->toolbox->getFileModified($fileNameOutput);
|
||||
}
|
||||
|
||||
// Check graphics library support
|
||||
public function isGraphicsLibrary() {
|
||||
return extension_loaded("gd") && function_exists("gd_info") && extension_loaded("exif");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// This file may be used and distributed under the terms of the public license.
|
||||
|
||||
class YellowInstall {
|
||||
const VERSION = "0.8.14";
|
||||
const VERSION = "0.8.15";
|
||||
const TYPE = "feature";
|
||||
const PRIORITY = "1";
|
||||
public $yellow; //access to API
|
||||
|
@ -17,10 +17,12 @@ class YellowInstall {
|
|||
// Handle request
|
||||
public function onRequest($scheme, $address, $base, $location, $fileName) {
|
||||
$statusCode = 0;
|
||||
if ($this->yellow->lookup->isContentFile($fileName)) {
|
||||
if ($this->yellow->lookup->isContentFile($fileName) || empty($fileName)) {
|
||||
$server = $this->yellow->toolbox->getServerVersion(true);
|
||||
$this->checkServerRewrite($scheme, $address, $base, $location, $fileName) || die("Datenstrom Yellow requires $server rewrite module!");
|
||||
$this->checkServerAccess() || die("Datenstrom Yellow requires $server read/write access!");
|
||||
$troubleshooting = "<a href=\"https://datenstrom.se/yellow/help/troubleshooting\">See troubleshooting</a>.";
|
||||
$this->checkServerConfiguration($server) || die("Datenstrom Yellow requires $server configuration file! $troubleshooting");
|
||||
$this->checkServerRewrite($scheme, $address, $base, $location, $fileName) || die("Datenstrom Yellow requires $server rewrite module! $troubleshooting");
|
||||
$this->checkServerAccess() || die("Datenstrom Yellow requires $server read/write access! $troubleshooting");
|
||||
$statusCode = $this->processRequestInstall($scheme, $address, $base, $location, $fileName);
|
||||
}
|
||||
return $statusCode;
|
||||
|
@ -268,6 +270,11 @@ class YellowInstall {
|
|||
return $statusCode;
|
||||
}
|
||||
|
||||
// Check web server configuration
|
||||
public function checkServerConfiguration($server) {
|
||||
return strtoloweru($server)!="apache" || is_file(".htaccess");
|
||||
}
|
||||
|
||||
// Check web server rewrite
|
||||
public function checkServerRewrite($scheme, $address, $base, $location, $fileName) {
|
||||
$curlHandle = curl_init();
|
||||
|
|
Loading…
Add table
Reference in a new issue