/** * 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); }
public function getBasePath() { if (php_sapi_name() === 'cli') { return Yii::getPathOfAlias('webroot.assets'); } return parent::getBasePath(); }
/** * 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); }
/** * Initializes the component. */ public function init() { $this->setClientScript(Yii::app()->clientScript); $this->setCacheBuster(Yii::app()->cacheBuster); parent::init(); }
public function getBaseRelUrl() { return parent::getBaseUrl(); }
public function getAssetManager() { $am = new CAssetManager(); //$this->getComponent('widgetFactory'); $am->setBasePath($this->getBasePath() . '/www/assets'); return $am; }
public function init() { $this->setBaseUrl(Yii::app()->request->baseUrl . "/index.php/" . self::DEFAULT_BASEPATH); parent::init(); }
public function publish($path, $hashByName = false, $level = -1, $forceCopy = null) { $hashByName = true; return parent::publish($path, $hashByName, $level, $forceCopy); }