How to find /mysite/ folder - SilverStripe CMS - silverstripe

I'm having some trouble finding my /mysite/ folder - I'm trying to edit my _config.php file so I can add some schema to a website however, there is no /mysite/ folder. Is it possible it was renamed something else, or simply doesn't exist? Is there a way I can find out which folder is the "/mysite/" folder?

The global variable $project is defined with the name of the "mysite" folder (it's basically the project folder).
So echoing that out from ContentController::init() would be a good way to determine it. Otherwise, just search the folders for "Page_Controller" and you should find the page class and where all the other work is stored.
global $project;
var_dump($project);
die;

It should be in your webroot, where also a /framework/ and a /cms/ folder should be. Look at the webserver configuration to find out where the root of your website is located.
How did you install silverstripe? Did you use composer? Did you download a ready-to-use zip? If yes, which one?

Related

Netbeans step through out of project tree files for debugging (PHP)

I am writing a Wordpress plugin that depends on another plugin with netbeans.
The project is just containing the files of my plugin and I want to keep it that way to have a clean git repository.
The problem:
I rely on another plugin and want to understand how that plugin works. For this, I want to "step through" the other plugin.
I want to do this on my localhost configuration.
I have basically two destinations:
The project is in my home directory in my github folder
The server files are under c:\wamp64\www\wordpress ...., where the localhost is running
The project is essentially set up correctly to copy files from my github directory to the localhost path (Properties -> Sources)
Then:
I set an include path to the localhost -> wordpress folder in the project properties, and when I now search for a definition in my code that refers to the other plugin, the corresponding file is opened (did not work before setting the include path)
Debugging essentially works, but when I step into a function of the other plugin, the bar becomes grey and the corresponding file is not opened.
Can I change some setting for netbeans to open up the other file (not in the project tree) and step through it?
I have found a reasonable workaround.
I just created a new PHP project in Netbeans with existing sources.
As source, I used the entire wordpress installation in the wamp server path, i.e. c:\wamp64\www\wordpress
I can now 'debug' and step through this new project, but I also need to add the corresponding breakpoints in the files from the server path.
It requires some discipline as I have to open the files from my plugin twice, once in the server path and once in the project path, but only edit the files in the project path.
It works 'ok', but I would still be interested to hear if someone has a more proper solution to this.

How to ignore changes in WordPress cache files in Git?

Every time I make a change to one of the WordPress theme files for my site there will be a lot of deleted cache files that automatically follow. Should I commit these changes using Git also or just ignore them? If the latter, what is the proper code I would use for this?
Thank you.
Well, I dont use wordpress, but if you are looking to ignore them you should have a file called .gitignore, and you are going to want to add those files (or if they are all in a folder, the folder) to the .gitignore file. https://github.com/DragonToothSoftware/SLang/blob/lexer-mod/.gitignore here is what mine looks like. It eliminates all of the cmake cache files
You should use a .gitignore file to exclude these files. They are auto-generated, so no need to keep them in repository

Index.php in uploads directory - Wordpress

I have a plugin on a Wordpress site called WP Security, most of the stuff it does is easy to use and understandable, the changes it suggests like not have default 'WP_' prefix for databases etc.
One of the things it highlights is: The index.php file was not found in the uploads directory! You should create one in order to prevent directory listings.
So can anyone tell why preventing directory listings is good and do I need to put anything in the index file, and if so what code do I need to put in? Finally what is the importance of the index file in website I don't really get this part of web design? I have read it has to be there to make site visible to browsers but why is this, why can't browsers just use the URL with no index page?
Thanks for suggestions
Andrew
Yes, blocking directory index is a good idea in web apps. The index.* file is interpreted by web server instead of providing standard directory listing. Creating an empty index.* file is ony one (although the easiest and compatible with all(?) http servers) way of blocking users from viewing the contents of the directory. Another way is to configure webserver to not serve the directory index. In Apache this can be done in the .conf file with
Options -Indexes
in the <Directory> clause. Or you might tell apache to:
AllowOverride All
And create a .htaccess in the directory containing:
Options -Indexes
line.
Yes creating index.* file is really necessary to protect your asset as absence of index files shows whole directory structure and listed assets.
Easiest way to create an index.php file with simple coding.

drupal path for multi sites environment

How to get path to sites DIR like i have sites/www.example.com i need to obtain this path inside a .tpl file of module, i tried drupal_get_path('theme','my_theme') and path_to_theme() but both of them point to the module DIR. any method that i can use to obtain path to my sites/example.com folder ?
Maybe the conf_path() will help you.
The question is, why do you need your sites/[site] directory?
maybe there's something misguided in your .tpl file. the drupal_get_path() should be sufficient.

moving a Drupal installation - what configuration changes required?

I would like to move a test Drupal installation from
/opt/lampp/htdocs/corporate/internet
to
/corporate/internet
What corresponding changes changes do I have to make in .htacess, settings.php and/or other settings?
That depends on that how your sites/ directory is set up. If you just have a default directory within, they you really should be good to go.
Mostly, you don't have to make changes. This is because Drupal installations tend to be set up to use relative paths that will be valid no matter where in the system it is. You may want to do a quick search of any custom code for the string /opt/lampp/htdocs to see if someone didn't do something relatively, but any other contrib code should work fine.
As Jubal mentions, sites set up in the sites directory may need renaming if you're going to be using a different URL to access the site - if you're moving from devel.site.com to www.site.com, and you have a sites/devel.site.com directory, then you're probably going to want to copy that directory to sites/www.site.com. On the other hand, if you're using sites/default for your site, or if you're not changing the url at all, then this isn't a problem.
Do note that the .htaccess in the root directory of Drupal is very important for Drupal to work, and that doing a simple cp -R of the directory will not copy the .htaccess, so make sure you copy that. (.htaccess files in sub-directories, like sites/default/files, will be fine, it's just this one in the root.)
And finally, check your file permissions after you move the files. You'll especially want to make sure that the file permissions for the files and tmp directories are correct so that people can properly upload files. (This may not be important - but it's something to check nonetheless.)

Resources