mirror of https://codeberg.org/Sonoj/osamc.de
Repair protocol php script and guard against the next php update fail
This commit is contained in:
parent
e4237262de
commit
095136c5df
|
@ -6,8 +6,19 @@
|
||||||
<pre> <!-- Keep pure text line breaks -->
|
<pre> <!-- Keep pure text line breaks -->
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//see https://github.com/vstelmakh/url-highlight
|
$autoloadPath = '/home/meeehgru/vendor/autoload.php';
|
||||||
require '/home/meeehgru/vendor/autoload.php'; //relative path with DIR . concat does not work
|
|
||||||
|
// Check if autoload.php file exists
|
||||||
|
if (!file_exists($autoloadPath)) {
|
||||||
|
echo "<p>PHP Configuration changed. The autoload.php file is missing. Please run <code>composer install</code> or <code>composer require vstelmakh/url-highlight</code>. Please inform the osamc.de staff about this problem.</p>";
|
||||||
|
} else {
|
||||||
|
require $autoloadPath;
|
||||||
|
|
||||||
|
// Check if UrlHighlight class exists
|
||||||
|
if (!class_exists(\VStelmakh\UrlHighlight\UrlHighlight::class)) {
|
||||||
|
echo "<p>PHP Configuration changed. Run <code>composer require vstelmakh/url-highlight</code>. Please inform the osamc.de staff about this problem.</p>";
|
||||||
|
} else {
|
||||||
|
// Your existing code goes here
|
||||||
use VStelmakh\UrlHighlight\UrlHighlight;
|
use VStelmakh\UrlHighlight\UrlHighlight;
|
||||||
$urlHighlight = new UrlHighlight();
|
$urlHighlight = new UrlHighlight();
|
||||||
|
|
||||||
|
@ -18,10 +29,11 @@ foreach(array_reverse($files) as $file){
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo $urlHighlight->highlightUrls(file_get_contents($file));
|
echo $urlHighlight->highlightUrls(file_get_contents($file));
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
fclose($out);
|
// Remove fclose($out); as $out is not defined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</pre>
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue