RE: [PEAR-DEV] package proposal: MIME_ContentType

From: Date: Mon, 16 Jun 2003 10:15:10 +0000
Subject: RE: [PEAR-DEV] package proposal: MIME_ContentType
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17509@lists.php.net to get a copy of this message
> From: Yavor Shahpasov [mailto:yavo@siava.org] > Sent: Sunday, June 15, 2003 3:09 PM > > +1 > > it looks like a usefull addition, some notes though, > it should come with it's own mime.types file which should go into > pear/data, > instead of relying on a file only found on unix machines > > second I see some unneeded overhead in the constructor > addTypes would call scanTypes with '/etc/mime.types' > and rescanTypes would do exactly the same, causing the same code to be > executed twise, correct me if am wrong thow. > > i see a small problem in this > > function MIME_ContentType($mimedb = '/etc/mime.types') { > $this->addTypes($mimedb); > $this->rescanTypes(); > } > > > function addTypes($types) { > if (!is_readable($types)) { > // FIXME > } > $this->_mimeTypes[] = $types; > $this->scanTypes($types); > } > > function rescanTypes() { > unset($this->_forward); > unset($this->_reverse); > foreach ($this->_mimeTypes as $file) > $this->scanTypes($file); > } > > > from the above it seems that on constructor scanTypes would be called two > times with the same file, i don't know but it seems like a few lost CPU > cycles to me I think he raises some valid points here. Other than that I generally like the proposal and the code looks good. So you have my +1 once this stuff is resolved. Regards, Lukas

« previous php.pear.dev (#17509) next »