Merge branch 'develop' of https://github.com/shish/shimmie2 into develop

This commit is contained in:
Shish 2018-11-10 12:01:55 +00:00
commit 1fb7e7b823
8 changed files with 40 additions and 26 deletions

View File

@ -17,8 +17,8 @@
# rather than link to images/ha/hash and have an ugly filename, # rather than link to images/ha/hash and have an ugly filename,
# we link to images/hash/tags.ext; mod_rewrite splits things so # we link to images/hash/tags.ext; mod_rewrite splits things so
# that shimmie sees hash and the user sees tags.ext # that shimmie sees hash and the user sees tags.ext
RewriteRule ^_images/([0-9a-f]{2})([0-9a-f]{30}).*$ images/$1/$1$2 [L] RewriteRule ^_images/([0-9a-f]{2})([0-9a-f]{30}).*$ data/images/$1/$1$2 [L]
RewriteRule ^_thumbs/([0-9a-f]{2})([0-9a-f]{30}).*$ thumbs/$1/$1$2 [L] RewriteRule ^_thumbs/([0-9a-f]{2})([0-9a-f]{30}).*$ data/thumbs/$1/$1$2 [L]
# any requests for files which don't physically exist should be handled by index.php # any requests for files which don't physically exist should be handled by index.php
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f

View File

@ -1,7 +1,6 @@
language: php language: php
php: php:
- 7.1 - 7.0
- 7.2
sudo: false sudo: false

View File

@ -29,7 +29,7 @@ check out one of the versioned branches.
# Requirements # Requirements
- MySQL/MariaDB 5.1+ (with experimental support for PostgreSQL 9+ and SQLite 3) - MySQL/MariaDB 5.1+ (with experimental support for PostgreSQL 9+ and SQLite 3)
- [Stable PHP](https://en.wikipedia.org/wiki/PHP#Release_history) (7.1+ as of writing) - [Stable PHP](https://en.wikipedia.org/wiki/PHP#Release_history) (7.0+ as of writing)
- GD or ImageMagick - GD or ImageMagick
# Installation # Installation
@ -50,6 +50,24 @@ check out one of the versioned branches.
4. Run `composer install` in the shimmie folder. 4. Run `composer install` in the shimmie folder.
5. Follow instructions noted in "Installation" starting from step 3. 5. Follow instructions noted in "Installation" starting from step 3.
# Docker
Useful for testing in a known-good environment, this command will build a simple debian image and run all the unit tests inside it:
```
docker build -t shimmie .
```
Once you have an image which has passed all tests, you can then run it to get a live system:
```
docker run -p 0.0.0.0:8123:8000 shimmie
```
Then you can visit your server on port 8123 to see the site.
Note that the docker image is entirely self-contained and has no persistence (assuming you use the sqlite database); each `docker run` will give a clean un-installed image.
### Upgrade from earlier versions ### Upgrade from earlier versions
I very much recommend going via each major release in turn (eg, 2.0.6 I very much recommend going via each major release in turn (eg, 2.0.6

View File

@ -23,7 +23,7 @@
], ],
"require" : { "require" : {
"php" : ">=7.1", "php" : ">=7.0",
"ext-pdo": "*", "ext-pdo": "*",
"flexihash/flexihash" : "^2.0.0", "flexihash/flexihash" : "^2.0.0",

View File

@ -108,8 +108,9 @@ function do_install() { // {{{
if(file_exists("data/config/auto_install.conf.php")) { if(file_exists("data/config/auto_install.conf.php")) {
require_once "data/config/auto_install.conf.php"; require_once "data/config/auto_install.conf.php";
} }
else if(@$_POST["database_type"] == "sqlite" && isset($_POST["database_name"])) { else if(@$_POST["database_type"] == "sqlite") {
define('DATABASE_DSN', "sqlite:{$_POST["database_name"]}"); $id = bin2hex(random_bytes(5));
define('DATABASE_DSN', "sqlite:data/shimmie.{$id}.sqlite");
} }
else if(isset($_POST['database_type']) && isset($_POST['database_host']) && isset($_POST['database_user']) && isset($_POST['database_name'])) { else if(isset($_POST['database_type']) && isset($_POST['database_host']) && isset($_POST['database_user']) && isset($_POST['database_name'])) {
define('DATABASE_DSN', "{$_POST['database_type']}:user={$_POST['database_user']};password={$_POST['database_password']};host={$_POST['database_host']};dbname={$_POST['database_name']}"); define('DATABASE_DSN', "{$_POST['database_type']}:user={$_POST['database_user']};password={$_POST['database_password']};host={$_POST['database_host']};dbname={$_POST['database_name']}");
@ -153,7 +154,6 @@ function ask_questions() { // {{{
if( if(
!in_array("mysql", $drivers) && !in_array("mysql", $drivers) &&
!in_array("pgsql", $drivers) && !in_array("pgsql", $drivers) &&
!in_array("sqlite", $drivers) !in_array("sqlite", $drivers)
) { ) {
$errors[] = " $errors[] = "
@ -201,7 +201,7 @@ function ask_questions() { // {{{
<th>Password:</th> <th>Password:</th>
<td><input type="password" name="database_password" size="40"></td> <td><input type="password" name="database_password" size="40"></td>
</tr> </tr>
<tr class="dbconf mysql pgsql sqlite"> <tr class="dbconf mysql pgsql">
<th>DB&nbsp;Name:</th> <th>DB&nbsp;Name:</th>
<td><input type="text" name="database_name" size="40" value="shimmie"></td> <td><input type="text" name="database_name" size="40" value="shimmie"></td>
</tr> </tr>
@ -360,29 +360,22 @@ function insert_defaults() { // {{{
function build_dirs() { // {{{ function build_dirs() { // {{{
// *try* and make default dirs. Ignore any errors -- // *try* and make default dirs. Ignore any errors --
// if something is amiss, we'll tell the user later // if something is amiss, we'll tell the user later
if(!file_exists("images")) @mkdir("images"); if(!file_exists("data")) @mkdir("data");
if(!file_exists("thumbs")) @mkdir("thumbs"); if(!is_writable("data")) @chmod("data", 0755);
if(!file_exists("data") ) @mkdir("data");
if(!is_writable("images")) @chmod("images", 0755);
if(!is_writable("thumbs")) @chmod("thumbs", 0755);
if(!is_writable("data") ) @chmod("data", 0755);
// Clear file status cache before checking again. // Clear file status cache before checking again.
clearstatcache(); clearstatcache();
if( if(!file_exists("data") || !is_writable("data")) {
!file_exists("images") || !file_exists("thumbs") || !file_exists("data") ||
!is_writable("images") || !is_writable("thumbs") || !is_writable("data")
) {
print " print "
<div id='installer'> <div id='installer'>
<h1>Shimmie Installer</h1> <h1>Shimmie Installer</h1>
<h3>Directory Permissions Error:</h3> <h3>Directory Permissions Error:</h3>
<div class='container'> <div class='container'>
<p>Shimmie needs to make three folders in it's directory, '<i>images</i>', '<i>thumbs</i>', and '<i>data</i>', and they need to be writable by the PHP user.</p> <p>Shimmie needs to have a 'data' folder in its directory, writable by the PHP user.</p>
<p>If you see this error, if probably means the folders are owned by you, and they need to be writable by the web server.</p> <p>If you see this error, if probably means the folder is owned by you, and it needs to be writable by the web server.</p>
<p>PHP reports that it is currently running as user: ".$_ENV["USER"]." (". $_SERVER["USER"] .")</p> <p>PHP reports that it is currently running as user: ".$_ENV["USER"]." (". $_SERVER["USER"] .")</p>
<p>Once you have created these folders and / or changed the ownership of the shimmie folder, hit 'refresh' to continue.</p> <p>Once you have created this folder and / or changed the ownership of the shimmie folder, hit 'refresh' to continue.</p>
<br/><br/> <br/><br/>
</div> </div>
</div> </div>

View File

@ -40,7 +40,7 @@ _d("TIMEZONE", null); // string timezone
_d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,setup,upgrade,handle_404,comment,tag_list,index,tag_edit,alias_editor"); // extensions to always enable _d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,setup,upgrade,handle_404,comment,tag_list,index,tag_edit,alias_editor"); // extensions to always enable
_d("EXTRA_EXTS", ""); // string optional extra extensions _d("EXTRA_EXTS", ""); // string optional extra extensions
_d("BASE_URL", null); // string force a specific base URL (default is auto-detect) _d("BASE_URL", null); // string force a specific base URL (default is auto-detect)
_d("MIN_PHP_VERSION", '7.1');// string minimum supported PHP version _d("MIN_PHP_VERSION", '7.0');// string minimum supported PHP version
_d("ENABLED_MODS", "imageboard"); _d("ENABLED_MODS", "imageboard");
/* /*

View File

@ -182,10 +182,10 @@ function warehouse_path(string $base, string $hash, bool $create=true): string {
$ab = substr($hash, 0, 2); $ab = substr($hash, 0, 2);
$cd = substr($hash, 2, 2); $cd = substr($hash, 2, 2);
if(WH_SPLITS == 2) { if(WH_SPLITS == 2) {
$pa = $base.'/'.$ab.'/'.$cd.'/'.$hash; $pa = 'data/'.$base.'/'.$ab.'/'.$cd.'/'.$hash;
} }
else { else {
$pa = $base.'/'.$ab.'/'.$hash; $pa = 'data/'.$base.'/'.$ab.'/'.$hash;
} }
if($create && !file_exists(dirname($pa))) mkdir(dirname($pa), 0755, true); if($create && !file_exists(dirname($pa))) mkdir(dirname($pa), 0755, true);
return $pa; return $pa;

View File

@ -48,6 +48,10 @@ if(!file_exists("data/config/shimmie.conf.php")) {
exit; exit;
} }
if(file_exists("images") && !file_exists("data/images")) {
die("As of Shimmie 2.7 images and thumbs should be moved to data/images and data/thumbs");
}
if(!file_exists("vendor/")) { if(!file_exists("vendor/")) {
//CHECK: Should we just point to install.php instead? Seems unsafe though. //CHECK: Should we just point to install.php instead? Seems unsafe though.
print <<<EOD print <<<EOD