Пример #1
0
 public static function revision($path = '.')
 {
     $path = DirUtils::normalizeDir($path);
     $rev = -1;
     if (file_exists($path . '.svn/entries')) {
         $rev = `svnversion {$path} --no-newline`;
         if (preg_match("/(\\d+)[MS]+/", $rev, $m)) {
             $rev = $m[1];
         }
     }
     return $rev;
 }
Пример #2
0
 public static function revision($path = '.')
 {
     $path = DirUtils::normalizeDir($path);
     $rev = -1;
     if (file_exists($path . '.hg')) {
         $rev = `hg tip --template "{rev}" -R {$path}`;
         if (preg_match("/(\\d+)/", $rev, $m)) {
             $rev = $m[1];
         }
     }
     return $rev;
 }
Пример #3
0
 public static function revision($path = '.')
 {
     $path = DirUtils::normalizeDir($path);
     $rev = -1;
     if (file_exists($path . '.git')) {
         $wd = getcwd();
         chdir($path);
         $rev = intval(`git rev-list HEAD --count`);
         chdir($wd);
     }
     return $rev;
 }
Пример #4
0
		public function run()
		{
			if (
				!($src = (string)$this->getXmlElement()->attributes()->src)
				||
				(
					strpos($src, '*') === false
					&&
					!file_exists(
						$this->getParentAction()->getBuild()->getPath()
						. DIRECTORY_SEPARATOR . $src
					)
				)
			) {
				throw new Exception('empty source filename');
			}

			if (strpos($src, '*') === false)
				$sources = array($src);
			else {
				if (is_dir(
						$dir = 
							$this->getParentAction()->getBuild()->getPath()
							. DIRECTORY_SEPARATOR 
							. substr($src, 0, strpos($src, '*') - 1)
					)
				) {
					foreach (
						array_keys(DirUtils::readDir($dir, DirUtils::DIRS))
						as 
						$name
					) {
						$sources[] = 
							substr($src, 0, strpos($src, '*')) 
							. $name . substr($src, strpos($src, '*')+1);
					}
				}
			}

			foreach ($sources as $source) {
				$file = 
					$this->getParentAction()->getBuild()->getPath()
					. DIRECTORY_SEPARATOR . $source;
				
				$this->setSource(file_get_contents($file));
				
				$pool = get_object_vars($this->getXmlElement()->children());
				if (!is_array($pool['edit'])) $pool['edit'] = array($pool['edit']);
				
				foreach ($pool['edit'] as $editElement) {
					EditAction::me()->
					setXmlElement($editElement)->
					setParentAction($this)->
					run();
				}
				
				if (!file_put_contents($file, $this->getSource())) {
					throw new Exception('Permision denied or another error');
				}
			}
		}
Пример #5
0
		function main($id, $mode)
		{
			global $config, $db, $user, $auth, $template, $cache;
			global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
			
			$this->tpl_name = 'acp_mods';
			$this->page_title = 'ACP_MODS';
			
			$this->tryBuild();
			
			if (
				is_dir(
					BUILDS_DIR . DIRECTORY_SEPARATOR . 
					$this->build->getHash() . DIRECTORY_SEPARATOR . 'install'
				)
			) {
				trigger_error(
					'Remove install dir('.
					BUILDS_DIR . DIRECTORY_SEPARATOR . 
					$this->build->getHash() . DIRECTORY_SEPARATOR . 'install'
					.') and refresh this page',
					E_USER_WARNING
				);
			}
			
			try {
				if (
					!empty($_REQUEST['action']) 
					&&
					in_array(
						$_REQUEST['action'], 
						array('installMods', 'installModsAndStyle')
					)
				) {
					DirUtils::clear($cache->cache_dir);
					if (!isset($_REQUEST['mod']) || !is_array($_REQUEST['mod']))
						$_REQUEST['mod'] = array();
						

					if ($_REQUEST['action'] == 'installModsAndStyle'){
						$this->installStyle($_REQUEST['styleName']);
					}
				$res = $this->installMods($_REQUEST['mod']);
					if ($res instanceof Build) {
						$template->assign_var('WARNING', true);
						
						foreach ($_REQUEST['mod'] as $name)
							$template->assign_block_vars(
								'mods',
								array('NAME'=>$name)
							);
						
						foreach ($res->getDependences('style') as $name)
							$template->assign_block_vars(
								'dependence',
								array('NAME'=>$name)
							);
					} elseif ($res instanceof self) {
						$template->assign_var('SUCCESS', true);
					} else
						$template->assign_var('WARNING2', true);
				}
			} catch (Exception $e) {
				$template->assign_var('WARNING', true);
				foreach ($_REQUEST['mod'] as $name)
					$template->assign_block_vars(
						'mods',
						array('NAME'=>$name)
					);
				if ($res)
				foreach ($res->getDependences('style') as $name)
					$template->assign_block_vars(
						'dependence',
						array('NAME'=>$name)
					);
			}
			
			$this->tryBuild();
//			error_reporting(E_ALL);
			foreach (Mod::getList() as $mod) {
				$template->assign_block_vars(
					'result', 
					array(
						'NAME'    => $mod->getName(),
						'DESC'    => $mod->getInfo(),
						'CHECKED' => 
							$this->build->inBuild($mod)
							? ' checked'
							: ''
					)
				);
			}
			return array();
		}
Пример #6
0
		public function run()
		{
			$pool = get_object_vars($this->getXmlElement());
			if (!is_array($pool['file'])) $pool['file'] = array($pool['file']);
			
			foreach ($pool['file'] as $fileElement) {
				$from 	= (string)$fileElement->attributes()->from;
				$to		= (string)$fileElement->attributes()->to;

				if (!$from || !$to) continue;
				
				if (strpos($to ,'language/')!==false) {
					$dirs = 
						DirUtils::getDirs(
							$this->getParentAction()->getBuild()->getPath()
							. DIRECTORY_SEPARATOR . 'language'
							,
							false
						);
					foreach ($dirs as $dir) {
						FileUtils::copy(
							$this->
							getParentAction()->
							getCurrentMod()->
							getPath() . DIRECTORY_SEPARATOR . $from
							,
							$this->
							getParentAction()->
							getBuild()->
							getPath()
							.DIRECTORY_SEPARATOR 
							. preg_replace(
						    	'!language/(\w*)/!iS', 
						    	'language/' . $dir . '/', 
						    	$to
						    )
						);
					}
				} elseif (strpos($from, "*") && strpos($to, "*")) {
					$from = dirname(
						$this->
						getParentAction()->
						getCurrentMod()->
						getPath() . DIRECTORY_SEPARATOR .$from
					);
					
					$to = dirname(
						$this->
						getParentAction()->
						getBuild()->
						getPath()
						.DIRECTORY_SEPARATOR . $to
					);
					
					if(is_dir($to)) {
						DirUtils::copyContent($from, $to);
					} else {
						DirUtils::copy($from, $to);
					}					
				} else {
					if (
						!is_dir(
							$this->
							getParentAction()->
							getCurrentMod()->
							getPath() . DIRECTORY_SEPARATOR . $from
						)
					) {
						FileUtils::copy(
							$this->
							getParentAction()->
							getCurrentMod()->
							getPath() . DIRECTORY_SEPARATOR . $from
							,
							$this->
							getParentAction()->
							getBuild()->
							getPath() . DIRECTORY_SEPARATOR . $to
						);
					} else {
						DirUtils::copy(
							$this->
							getParentAction()->
							getCurrentMod()->
							getPath() . DIRECTORY_SEPARATOR . $from
							,
							$this->
							getParentAction()->
							getBuild()->
							getPath() . DIRECTORY_SEPARATOR . $to
						);
					}
				}
			}
		}