예제 #1
0
	/**
	 * Updates the backup statistics record
	 * @return bool
	 */
	private function update_statistics()
	{
		$this->setStep('Updating statistics');
		$this->setSubstep('');
		
		// Force a step break before updating stats (works around MySQL gone away issues)
		// 3.2.5 : Added conditional break logic after the call to setStatistics()
		/**
		if(!$this->update_stats)
		{
			$this->update_stats = true;
			$configuration =& AEFactory::getConfiguration();
			$configuration->set('volatile.breakflag', true);
			return false;
		}
		/**/

		AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Updating statistics" );
		// We finished normally. Fetch the stats record
		$statistics =& AEFactory::getStatistics();
		$registry =& AEFactory::getConfiguration();
		$data = array(
			'backupend'	=> AEPlatform::get_timestamp_mysql(),
			'status'	=> 'complete',
			'multipart'	=> $registry->get('volatile.statistics.multipart', 0)
		);
		$result = $statistics->setStatistics($data);
		if($result === false) {
			// Most likely a "MySQL has gone away" issue...
			$this->update_stats = true;
			$configuration =& AEFactory::getConfiguration();
			$configuration->set('volatile.breakflag', true);
			return false;
		}
		$this->propagateFromObject($statistics);

		$stat = (object)$statistics->getRecord();
		AEPlatform::remove_duplicate_backup_records($stat->archivename);

		return true;
	}