public function testCleanFilename() { $input = "This, ladies and gentlemen, is a filename"; $result = \Nodes\Common::cleanFilename($input); $expected = "This- ladies and gentlemen- is a filename"; $this->assertSame($expected, $result); }
/** * Remove symlinks from each plugin to app/webroot * * @return void */ public function remove() { chdir(realpath(WWW_ROOT)); $paths = $this->_getPaths(); foreach ($paths as $plugin => $config) { $this->out('Processing plugin: <info>' . $plugin . '</info>'); if (!file_exists($config['public'])) { $this->out('--> <error>Skipping</error>, symlink does not exists (' . Nodes\Common::stripRealPaths($config['public']) . ')'); continue; } if (!is_link($config['public'])) { $this->out('--> <error>Skipping, target is not a symlink</error>'); continue; } $symlinkTarget = readlink($config['public']); $this->out('----> Current target is ' . $symlinkTarget); if ($config['relative_private'] !== $symlinkTarget) { $this->out('--> <error>Skipping, symlink source does not match ours</error>'); continue; } if (unlink($config['public'])) { $this->out(sprintf('--> <info>OK</info>, symlink removed (%s => %s)', \Nodes\Common::stripRealPaths($config['private']), \Nodes\Common::stripRealPaths($config['public']))); } else { $this->out('--> <error>Error</error>'); } } }