/** * Publishes a file or a directory. * * Will use linkAssets even if $forceCopy is true * * @param string $path * @param bool $hashByName * @param int $level * @param null $forceCopy */ public function publish($path, $hashByName = false, $level = -1, $forceCopy = null) { if ($forceCopy && $this->linkAssets) { $forceCopy = null; } return parent::publish($path, $hashByName, $level, $forceCopy); }
/** * Forces copy while debugging mode on * @param string $path * @param bool $hashByName * @param int $level * @param bool $forceCopy * @return string */ public function publish($path, $hashByName = false, $level = -1, $forceCopy = false) { if (YII_DEBUG) { $forceCopy = true; $hashByName = false; } return parent::publish($path, $hashByName, $level, $forceCopy); }
public function testPublishFile() { $app = new TestApplication(); $app->reset(); $am = new CAssetManager(); $am->init($app); $path1 = $am->getPublishedPath(__FILE__); clearstatcache(); $this->assertFalse(is_file($path1)); $url = $am->publish(__FILE__); $path2 = $am->getPublishedPath(__FILE__); $this->assertEquals($path1, $path2); clearstatcache(); $this->assertTrue(is_file($path1)); $this->assertEquals(basename($path1), basename(__FILE__)); $this->assertEquals($url, $am->baseUrl . '/' . basename(dirname($path2)) . '/' . basename($path2)); }
/** * @param string $path * @param bool $hashByName * @param int $level * @param null $forceCopy * @return mixed */ public function publish($path, $hashByName = false, $level = -1, $forceCopy = null) { if (($src = realpath($path)) !== false) { switch (pathinfo($src, PATHINFO_EXTENSION)) { case 'less': $path = $this->lessCompile($src); } } return parent::publish($path, $hashByName, $level, $forceCopy); }
public function publish($path, $hashByName = false, $level = -1, $forceCopy = null) { $hashByName = true; return parent::publish($path, $hashByName, $level, $forceCopy); }