public function show() { if (session_id() === '') { // Send a cookie so anons get talk message notifications wfSetupSession(); } parent::show(); }
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'); } } }
public function show() { // Send a cookie so anons get talk message notifications MediaWiki\Session\SessionManager::getGlobalSession()->persist(); parent::show(); }