User Tools

Site Tools


updates

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
updates [2017/04/14 12:05] adminupdates [2026/03/21 10:12] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Update ======+====== Updates ====== 
 + 
 +Updates help us and you keep your copy up-to-date. With updates, new features and other improvements are added to the script. Within a single update there can be different builds with minor fixes. The update and build number is written at the end of each page.
  
-Updates help us and you to keep your copy in actual state. Updates contists of some changes to DB and files reflecting new features in script. 
-To appaly an update to your script just click on Home at the top of you admin are and select an update. Make sure you apply updates step by step, do not skip updates. At the same page you can see your current version. 
  
 ====== How to run update ====== ====== How to run update ======
 +
 +Click Maintenance - Update in the admin panel or run in the shell
  
 <code> <code>
 cd your_path_to/scj/admin/ cd your_path_to/scj/admin/
-php update.php (опционально номер апдейта)+php update.php
 </code> </code>
 +
 +and the script will be updated to the current version
  
 ====== TCMS (Smartcj 2.X) Updates ====== ====== TCMS (Smartcj 2.X) Updates ======
Line 18: Line 22:
  
 ====== SmartCJ v 1.X Updates ====== ====== SmartCJ v 1.X Updates ======
 +
 +
 +In version 1 each update had to be installed sequentially
 +
 +<code>
 +cd your_path_to/scj/admin/
 +php update.php update_number
 +
 +
 +for example if you are on 49 and need to reach 52
 +
 +php update.php 50
 +php update.php 51
 +php update.php 52
 +
 +
 +</code>
 +
  
  
Line 70: Line 92:
 [[Update 28]] [[Update 28]]
  
 +  * Base command to run all updates. It will update your script to the latest version
 +<code>
 +cd /path_to_scj/admin; env HTTP_HOST=yourdomain.com php update.php
 +</code>
  
-====== Multidomain Update ====== 
  
-You can create a file with all your domains+===== How to run a specific update ===== 
 + 
 + 
 +<code> 
 +cd /path_to_scj/admin; env HTTP_HOST=yourdomain.com php update.php update_number 
 +for example 
 +cd /home/vasya/domain.com/scj/admin; env HTTP_HOST=domain.com php update.php 45 
 +</code> 
 + 
 + 
 + 
 +update.php source code 
 + 
 +<code> 
 + 
 +<?php 
 + require('../includes/prepare.php'); 
 + require('../includes/libs/http_functions.php'); 
 + 
 +    // out of space fix 
 +    $df = disk_free_space("./"); 
 +    if ($df < 5*1024*1024) { 
 +    die("No enough space for update"); 
 +    } 
 + 
 + // slow connection fix 
 + $mysql_version = db_value('ver', 'select version() as ver'); 
 + if (stristr($d['ver'], '5.')) { 
 + db_query("set wait_timeout=240"); 
 +
 + 
 + if ($argv[1] != ''
 + $num = (int) $argv[1]; 
 + if ($num > 0) { 
 + ProcessUpdate($num); 
 + exit; 
 +
 +
 + 
 + $tmp = get_url("http://smartcj.com/smartnews.php?action=last_update"); 
 + if ($tmp['status'] != 200) { 
 + die("Can not get last update number, please, contact support"); 
 +
 + 
 + $last_script_version = $tmp['body']; 
 + 
 + if ($last_script_version == $settings['last_update_number'] and !$_REQUEST['force_update']) die("You have the lastest version."); 
 + 
 + while ($settings['last_update_number'] < $last_script_version) { 
 + echo "Processing " . ($settings['last_update_number']+1) . "\n"; 
 + if (ProcessUpdate($settings['last_update_number']+1)) { 
 + $settings['last_update_number']++; 
 +
 +
 + 
 + 
 + 
 +function ProcessUpdate($update_id) { 
 + global $settings; 
 + 
 + $tmp = get_url("http://smartcj.com/updates/".(int)$update_id."/update.txt"); 
 + if ($tmp['status'] != 200)  { 
 + echo "Sorry, can not find  update {$update_id}"; 
 + return false; 
 +
 + $_REQUEST['terms_read'] = true; 
 +    ob_start(); 
 + eval ('?>' . $tmp['body']); 
 + $res = ob_get_clean(); 
 + $res = str_replace('<br>', "\n", $res); 
 +    echo strip_tags($res); 
 + 
 + return true; 
 + 
 +
 + 
 + 
 + 
 +</code> 
 + 
 + 
 + 
 +====== How to update all domains at once ====== 
 + 
 +You can create a file, for example update.sh, which contains lines like this: 
 + 
 +  cd /path_to_domain/scj/admin; env HTTP_HOST=yourdomain.com php update.php 
 +  cd /path_to_domain2/scj/admin; env HTTP_HOST=yourdomain2.com php update.php 
 + 
 +and so on for as many lines as needed. And run it from the shell
  
-  cd /path_to_domain/scj/admin; env HTTP_HOST=yourdomain.com php update.php  
-  cd /path_to_domain2/scj/admin; env HTTP_HOST=yourdomain2.com php update.php  
-   
-and so on and run it in SSH 
-   
   sh update.sh   sh update.sh
-   
  
-This way you can update all domains at once. 
  
-Note: update script doesn't overwrite index.php or any other files at the root of your domain. So you have to copy index.php (if you use it)If you don't want to do it each time you have 2 options: +During installation and update, the script does not write index.php or any files to the domain root, so as not to accidentally overwrite anything you have thereAccordingly, during updates, the question arises of copying the Smart index if it is used on the domain rootThere are 2 options: 
-  - add to update.sh something like "cp ../cgi/index.php  ../../index.php " +  - add lines like cp ../cgi/index.php  ../../index.php to update.sh 
-  - or create a symlink to original scj/cgi/index.php+  - or at installation time, do not copy the index, but make a symlink to the corresponding directory. 
 + 
 +====== How to rollback an update ====== 
 + 
 +The only way is if you have a backup from the version you need. 
 + 
 +You need to install the script of that version and upload the backup of the MySQL database from the same version. 
 + 
 +You cannot just upload a backup of MySQL from version 44 to version 45 script for example. 
 + 
 + 
 +====== How to update a site with a very large database ====== 
 + 
 +Update can be a fairly heavy procedure for the server, and some pages may be incorrectly cached, etc. Some services, for example in case of a major update release, usually do this at night and close the site, showing a standard message that the service will be available in a few hours. But if you don't want to interrupt operations, you can do it as follows. To do this you need to 
 + 
 +  - Install the script on another (sub)domain, ideally on a different server 
 +  - Upload the database from the main domain there 
 +  - Run the update on this separate subdomain 
 +  - All heavy database procedures will run there, while the main site remains unaffected 
 +  - Transfer the database from the auxiliary domain to the main one 
 +  - Perform the update on the main - it will go quickly as the database is already changed, you only need to download the files. 
  
-====== Update rollback ====== 
  
-There's no built-in update rollback. The only chance is if you have created backup. Note, if you just restored mysql db - it won't help caz you still have the same files. 
updates.1492171503.txt.gz · Last modified: (external edit)