mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
do not use version.txt and @VERSION
This commit is contained in:
parent
c325eea23a
commit
05b49d30d8
6 changed files with 18 additions and 30 deletions
|
|
@ -29,9 +29,6 @@ indent_size = 2
|
|||
trim_trailing_whitespace = false
|
||||
insert_final_newline = false
|
||||
|
||||
[/version.txt]
|
||||
insert_final_newline = false
|
||||
|
||||
[/src/content/themes/*/index.php]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
|
|
|||
20
buildzip.php
20
buildzip.php
|
|
@ -31,12 +31,9 @@ if (!is_dir($dir)) {
|
|||
print "> Repository was cloned to temp dir: $dir\n";
|
||||
|
||||
#get current version number if not specified
|
||||
if (!$ver)
|
||||
{
|
||||
chdir($dir);
|
||||
$fh = fopen('version.txt', 'r') or die("Cant open version.txt\n");
|
||||
$ver = trim(fgets($fh, 100));
|
||||
fclose($fh);
|
||||
if (!$ver) {
|
||||
require_once(__DIR__ . '/src/includes/version.php');
|
||||
$ver = mytinytodo\Version::VERSION;
|
||||
}
|
||||
chdir($dir. DIRECTORY_SEPARATOR. 'src');
|
||||
$rev = trim(`git show --format=format:%H --summary`);
|
||||
|
|
@ -52,10 +49,6 @@ fwrite($fh, "\n<!-- $rev -->");
|
|||
fclose($fh);
|
||||
*/
|
||||
|
||||
#replace @VERSION
|
||||
replaceVer('./setup.php', $ver);
|
||||
replaceVer('./init.php', $ver);
|
||||
|
||||
unlink('./docker-config.php');
|
||||
unlink('./content/lang/en-rtl.json');
|
||||
/*
|
||||
|
|
@ -111,10 +104,3 @@ function deleteTreeIfDir($dir)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function replaceVer($filename, $ver)
|
||||
{
|
||||
$s = @file_get_contents($filename) or die("Cant open $filename\n");
|
||||
$s = str_replace('@VERSION', $ver, $s);
|
||||
@file_put_contents($filename, $s) or die("Cant write $filename\n");
|
||||
}
|
||||
8
src/includes/version.php
Normal file
8
src/includes/version.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace mytinytodo;
|
||||
|
||||
class Version
|
||||
{
|
||||
const VERSION = '1.7';
|
||||
}
|
||||
10
src/init.php
10
src/init.php
|
|
@ -5,8 +5,6 @@
|
|||
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
|
||||
*/
|
||||
|
||||
define('MTT_VERSION', '@VERSION');
|
||||
|
||||
##### MyTinyTodo requires php 7.0 and above! #####
|
||||
if (version_compare(PHP_VERSION, '7.0.0') < 0) {
|
||||
die("PHP 7.0+ is required");
|
||||
|
|
@ -35,6 +33,7 @@ require_once(MTTINC. 'common.php');
|
|||
require_once(MTTINC. 'class.dbconnection.php');
|
||||
require_once(MTTINC. 'class.dbcore.php');
|
||||
require_once(MTTINC. 'class.config.php');
|
||||
require_once(MTTINC. 'version.php');
|
||||
|
||||
|
||||
# MySQL Database Connection
|
||||
|
|
@ -256,11 +255,8 @@ function get_unsafe_mttinfo($v)
|
|||
$_mttinfo['title'] = (Config::get('title') != '') ? Config::get('title') : __('My Tiny Todolist');
|
||||
return $_mttinfo['title'];
|
||||
case 'version':
|
||||
if (MTT_VERSION != '@'.'VERSION') {
|
||||
$_mttinfo['version'] = MTT_VERSION;
|
||||
return $_mttinfo['version'];
|
||||
}
|
||||
return time(); //force no-cache for dev needs
|
||||
if (MTT_DEBUG) return time(); //force no-cache for dev needs
|
||||
return mytinytodo\Version::VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@ if (!defined('MTTINC')) define('MTTINC', MTTPATH. 'includes/');
|
|||
require_once(MTTINC. 'common.php');
|
||||
require_once(MTTINC. 'class.dbconnection.php');
|
||||
require_once(MTTINC. 'class.config.php');
|
||||
require_once(MTTINC. 'version.php');
|
||||
|
||||
$mttVersion = mytinytodo\Version::VERSION;
|
||||
$db = null;
|
||||
$ver = '';
|
||||
$error = '';
|
||||
|
|
@ -30,8 +32,8 @@ $configExists = file_exists(MTTPATH. 'config.php');
|
|||
$oldConfigExists = file_exists(MTTPATH. 'db/config.php');
|
||||
|
||||
|
||||
echo '<html><head><meta name="robots" content="noindex,nofollow"><title>myTinyTodo @VERSION Setup</title></head><body>';
|
||||
echo "<big><b>myTinyTodo @VERSION Setup</b></big><br><br>";
|
||||
echo '<html><head><meta name="robots" content="noindex,nofollow"><title>myTinyTodo $mttVersion Setup</title></head><body>';
|
||||
echo "<big><b>myTinyTodo $mttVersion Setup</b></big><br><br>";
|
||||
|
||||
if (!$configExists && $oldConfigExists)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
1.7
|
||||
Loading…
Reference in a new issue