mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 00:50:18 +01:00 
			
		
		
		
	switch the »current« symlink in an atomic way
This commit is contained in:
		
							parent
							
								
									683d11ac90
								
							
						
					
					
						commit
						4e17263773
					
				@ -75,9 +75,10 @@ class ReleaseTask extends AbstractTask implements IsReleaseAware, SkipOnOverride
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Remove symlink if exists; create new symlink and change owners
 | 
					            // Remove symlink if exists; create new symlink and change owners
 | 
				
			||||||
            $command = 'rm -f ' . $symlink
 | 
					            $tmplink = $currentCopy . '.tmp';
 | 
				
			||||||
                . ' ; '
 | 
					            $command = 'ln -sfn ' . $currentCopy . ' ' . $tmplink
 | 
				
			||||||
                . 'ln -sf ' . $currentCopy . ' ' . $symlink;
 | 
					                . ' && '
 | 
				
			||||||
 | 
					                . 'mv -T ' . $tmplink . ' ' . $symlink;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($resultFetch && $userGroup != '') {
 | 
					            if ($resultFetch && $userGroup != '') {
 | 
				
			||||||
                $command .= ' && '
 | 
					                $command .= ' && '
 | 
				
			||||||
 | 
				
			|||||||
@ -127,9 +127,11 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    $userGroup = '';
 | 
					                    $userGroup = '';
 | 
				
			||||||
                    $resultFetch = $this->runCommandRemote('ls -ld ' . $rollbackTo . ' | awk \'{print \$3":"\$4}\'', $userGroup);
 | 
					                    $resultFetch = $this->runCommandRemote('ls -ld ' . $rollbackTo . ' | awk \'{print \$3":"\$4}\'', $userGroup);
 | 
				
			||||||
                    $command = 'rm -f ' . $symlink
 | 
					
 | 
				
			||||||
 | 
					                    $tmplink = $rollbackTo . '.tmp';
 | 
				
			||||||
 | 
					                    $command = 'ln -sfn ' . $currentCopy . ' ' . $tmplink
 | 
				
			||||||
                             . ' && '
 | 
					                             . ' && '
 | 
				
			||||||
                             . 'ln -sf ' . $rollbackTo . ' ' . $symlink;
 | 
					                             . 'mv -T ' . $tmplink . ' ' . $symlink;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if ($resultFetch) {
 | 
					                    if ($resultFetch) {
 | 
				
			||||||
                        $command .= ' && chown -h ' . $userGroup . ' ' . $symlink;
 | 
					                        $command .= ' && chown -h ' . $userGroup . ' ' . $symlink;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user