Overriding Yii::autoload

First: sorry if this post should have gone in the Design forum.

So I’m building a web app and it gets installed by lots of people. People want to modify the code, but we want our automatic updates to still work. My solution is to create a “custom” file tree, mirroring the normal files (but empty). Every time a class or view is loaded, some code will check in there to see if there’s a custom version.

So, I got views working great by extending CController::renderFile() and CWidget::renderFile() to first look in this custom folder. I’m now trying to get Yii::import and Yii::autoload to do the same. We’ve been trying as hard as we can to avoid modifying any framework files, such as YiiBase, and I’m trying to get the Yii class to contain all the changes. Problem is, the people at Yii seem to be obsessed with private variables, and things such as $_includePaths, $_coreClasses, etc. can’t be used in an overridden autoload method.

So my first request is, make these variables protected so there’s actually a purpose to having Yii extend YiiBase.

Second, after a while of playing around with import() and autoload(), I realized you can register your own autoload method externally, without modifying YiiBase. This would be great if (1) all these variables weren’t private, and (2) if this method was used in YiiBase::import() here:

		if(($pos=strrpos($alias,'.'))===false)  // a simple class name


			if($forceInclude && self::autoload($alias))


			return $alias;


Since this calls self::autoload, the custom autoload method is bypassed, in fact it doesn’t even use Yii::autoload() if I define that. So the only way to actually implement your own autload function is to either change a bunch of stuff in YiiBase, or override basically the entire class, including $_coreClasses and such.

Is there something I’m missing? Or am I just going to have to modify YiiBase?