#1 2010-08-26 14:49:29

gesmit
Ion Tester
From: Netherlands
Registered: 2010-08-26
Posts: 20

Removed .svn folders from admin theme settings

As SVN user, you always have .svn folders. These folders also show up in the admin in the theme settings.

I modified _get_view_files in /controllers/admin/setting.php a little to hide them:

/**
     * Get the views file list as an array
     *
     * @return array    Files names list
     *
     */
    function _get_view_files()
    {
        $views = array();
        
        $theme_path = APPPATH.'../themes/'.Settings::get('theme').'/views';

        if (is_dir($theme_path))
        {
            $dir_iterator = new RecursiveDirectoryIterator($theme_path);
            $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
            
            foreach ($iterator as $file)
            {
                if ($file->isFile() && (substr($file->getFilename(), 0, 1) != ".") )
                {
                    // Set a human readable path
                    $path = str_replace($theme_path, '', $file->getPath());
                    $path = str_replace('\\', '/', $path) . '/';
                    $path = substr($path,1);
                    if (strpos($path, '.svn') === false)
                    {
                        // Set the path
                        $file->path = $path;
                        
                        // Set the view ame (filename without .php extension)
                        $file->name = str_replace('.php', '', $file->getFilename());
                        
                        $views[] = $file;
                    }
                }
            }
        }
        return $views;
    }

Offline

#2 2010-08-26 19:39:39

toopixel
Ionize Core Team
From: Geneva
Registered: 2010-04-20
Posts: 272
Website

Re: Removed .svn folders from admin theme settings

I don't think this hack is needed, the goal of SVN is to develop the CMS, as CMS users you should export the sources using your SVN software which would then not have .svn folders.


Too Pixel is a web agency located in Geneva, Switzerland

Offline

#3 2010-08-26 20:30:55

Michel-Ange
Ionize Core Team
From: Paris, France
Registered: 2010-03-22
Posts: 927
Website

Re: Removed .svn folders from admin theme settings

Thanks Gesmit for this post !

Of course it could help developpers, but in a production system, most of the users will not need it ! wink


Inspiration & Innovation : Websites by Partikule, Agence Web Paris

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations