Make a backup before upgrading

Collapse
This is a sticky topic.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 9803

    #1

    Make a backup before upgrading

    To be able to roll back if your instance stopped to work after upgrade.



    While it's quite OK to upgrade without making a backup before (what I usually do), it requires some experience to be able to tackle issues quickly if the upgrade failed. Having a backup is easier for the most.
    Last edited by yuri; 08-20-2025, 07:15 AM.
  • item
    Active Community Member
    • Mar 2017
    • 1567

    #2
    Hello Yuri,

    Maybe can you integrate this in upgrade process ? I know you have provide backup script.
    (my backup is not accessible by http .... maybe it's "risk" for newbee)

    i have make a job for this : (deleted path)

    PHP Code:
    <?php
    
    namespace Espo\Custom\Jobs;
    
    use Espo\Core\ORM\{
    Entity,
    EntityManager,
    ServiceFactory,
    Jobs\Job,
    };
    
    class BackupJobs extends \Espo\Core\Jobs\Base
    {
    
    public function run()
    {
    $GLOBALS['log']->warning( "BackupJobs Begin : " .date('Y-m-d') );
    $pdo = $this->getEntityManager()->getPDO();
    $sql = "DELETE FROM scheduled_job_log_record WHERE status='Success';DELETE FROM job WHERE status='Success'";
    $sth = $pdo->prepare($sql);
    $sth->execute();
    
    @exec('bash ./backup.sh > /dev/null &');
    $GLOBALS['log']->warning( "BackupJobs End : " .date('Y-m-d') );
    return true;
    }
    }



    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    Working...