SVN post-commit hook which update changelog.txt in Windows OS - php

I'am new to SVN, and I can't find a solution to make "after commit" update a specific txt file.
I have a php project, within changelog.txt inside the root folder (at the same level where index.php is located). What I want is that after each svn commit, my changelog.txt will be updated with some information by looking like this:
*** YYYY-MM-DD HH:MM by SVN_USERNAME
SVN_COMMIT_MESSAGE
-------------------------------------------------
*** 2010-09-22 18:31 by marco.belinni
- eshop category navigation - fixed issue with navigation, due overcaching with previous version of seo tool
-------------------------------------------------
*** 2010-09-20 01:03 by jean.laroche
- plg_c16n - fixed canonicalization with SEO Plugin which redirects non www urls to www urls
- mod_login - fixed ie and ff login, hidded input type "remember me" with checked paramater
- the whole frontpage have bolded text because of bolded "READ MORE" button - need to clean it before posting any article
- eshop browse - 10products per page FIXED by clearing cache and purged ALL urls
- eshop orderby - removed useless "SELECT" option in selection field for sorting out the items on page
-------------------------------------------------
I tried to find some info but there was a plenty websites showing the exemples with C++ programming. Is there any other solution to use only SVN and PHP ? As I'am not even a newbie in C++.
UPDATED
Here is a visual to show you where my changelog.txt is:
- web
|- framework
| + engine
| + framework
- web
+ css
+ images
| index.php
-->| changelog.txt
Thanks

I'm going to assume your changelog is stored in SVN itself. In which case, stop right there.
You cannot update a file that's stored in SVN after committing, because it will then need committing, which will trigger the update that makes it need committing... you get the idea.
You can happily write data to a new file and use that however, simply create a file called post_commit in the hooks directory and put some script in it (and script language you like) to call svn log, pipe the output to your changelog file.

Related

Magento - Child theme starting point

I've recently started to learn Magento (very recently) - and I followed this link to get started on XAMPP https://magenticians.com/install-magento-2-on-localhost-using-xampp/
I now have a localhost setup of XAMPP, and would like to start making changes to the site. I have read that you need to create a 'child-theme' but really unsure of where to start on this.
I can see 2 themes at C:\xampp\htdocs\magento\vendor\magento\theme-frontend-luma
but can't see any at C:\xampp\htdocs\magento\app\design\frontend
Does anyone have a pointer in the right direction? or even a version with populated content/a child theme ready to edit?
Sorry and thanks in advance
you need follwing file for making child theme
app> design> forntend> <Vendor> / <Theme_Child> /
1- composer.json (optional in case parent have)
2- registration.php
3- media folder (with preview image)
4- Magento_Theme
5- etc
6- view.xml

Netbeans and Codeigniter Applications

I'm still trying to figure out how to work with netbeans and codeigniter projects. I have the following structure tree and I am trying to figure out tht when I open up http://localhost/MyFirstProject that it'll use the index.php file that resides in the site folder. Anybody use netbeans here and can tell me. I've already started the project.
Projects
- MyFirstProject
- Source Files
- application
- site
- assets
index.php
- system
- Test Files
- Important Files
- Include Path
It looks like you're using a bit of a non-standard layout, but you can change the index.php file like this:
In the project explorer, right click on your project MyFirstProject
Select Properties
Select the 'Run Configuration' category
Modify the 'Index File' field to point to site/index.php (you can use the browse button to select it)
Enjoy :-)

Eclipse PHP - cannot find validation section to exclude .xml files from validation

Using Eclipse for PHP Developers Version: 3.0.2 (latest Zend download)
What I want to do, is to exclude some single .xml / .html files from validation. Seemed to be straight forward.
SO " https://stackoverflow.com/a/5288496/356726 " says to use Project / Properties / Validation, but I do not have this menu item.
SO " How to exclude specific folders or files from validation in Eclipse? " refers to Window / Preferences. I checked through the sections in order to find the exclude sections, but I was unable to locate it. I can set project specific settings, but where do I exclude single files?
What do I miss? I am sure it is pretty simple.
Project Properties:
Window / Preferences:
This worked for me (Eclipse Indigo, Java project):
project -> right click -> Properties -> Validation
check Enable project specific settings
XmlValidator: check Manual, check Build, click "..." for Settings
Add Exclude Group, select it
Add Rule -> Folder or file name -> select file you want to ignore
refresh project (or close and open)
This instruction assumes the button Add Exclude Group in step 4 is enabled. However, in my case the button was disabled. I don't know the reason but I discovered following workaround:
4a. Add (empty) Include Group
4b. Open file PROJECT_HOME.settings\org.eclipse.wst.validation.prefs
4c. Edit key vals/org.eclipse.wst.xml.core.xml/groups - change 07include00 to 07exclude00 near the end of string
4d. Refresh project, open project properties again

CodeIgniter 2.1 and SimpleTest - Conducting a simple test

I am currently using CI 2.1 and Netbeans 7.0 as my inveiglement IDE. I would like to create some simple unit testing using SimpleTest. In particular the methodology used by Eric Barnes and his code found at Git Hub CodeIgniter-SimpleTest. (https://github.com/ericbarnes/codeigniter-simpletest)
I have created a new CI application using Netbeans 7.0 and connected to my database (which contains 1 table called schools with the typical schema schoolid, schoolname, schooladdress etc.). I have created a controller (simpleapp), which loads a model called schools_model. The schools_model gets all the schools using a method called getAll(). Another method called getSchoolName(id), accepts a school ID and returns the school name.
The controller then loads a view called schools_view to display all the schools. Pretty simple stuff…....... and it works flawlessly, displaying all the schools when I point my browser to
http://localhost/SimpleTest/simpleapp/getAllSchools
(I am also using a .htaccess file, hence no index.php)
My question is this….......
How do I get SimpleTest to work using the Git hub code supplied by Eric?
I have followed Eric’s set-up advise, but don’t know what URL to point to to create the screen dumps he provides. I have maintained the directory structure Eric suggests but haven’t had any success. Eric suggest to point the browser to yoursite.com/unit_test.php, but I get a
404 page not found error for localhost/SimpleTest/unit_test.php
I assume the above error is due to the fact, like most CI applications, we need to use a controller first.
I would appreciate any direction in this area.
I have done exactly what you suggested. I have placed the unit_test.php file in the root directory and set up the test directory structure as suggested. However, when I point to localhost/SimpleTest/unit_test.php I get the 404 error.
My directory structure looks like
Source Files
-application (folder)
-system(folder)
-tests(folder from git hub with model/test_schools_model.php)
-.htaccess
-index.php
-licence.txt
-unit_test.php
Is it a .htaccess issue the reason I cannot view localhost/SimpleTest/unit_test.php?
You are correct you need to go to yoursite.com/unit_test.php or in your case localhost/SimpleTest/unit_test.php
You need to copy the unit_test.php file from github into the sites root directory and place the tests directory there too. You then put your tests in the appropriate folder under tests/

Bash Script to Update Admin User Password for Multiple Drupal Sites on a Server spread over Multiple Versions

I have a server that runs quite a few Drupal sites. Some of these are older and running Drupal 5, while some are newer and running Drupal 6. We're also beginning to implement Drupal 7.
Our organization uses one standard Website Administration password that we distribute internally only to our employees for maintenance of these websites. This may or may not be the best security practice, but it is how we do things at this time. Please assume that this won't change.
The problem we have is that when we have employee turnover, we must change this password and apply the change to every site we run in order to make sure that the employee cannot deface any of our clients' sites. This is more critical for firings, but we also do it for resignations as a best practice.
In the past, I ran a basic PHP script that used mysql_list_dbs on our Database server to iterate through every database and change the pass field of the users table where the name = admin. BasicallY:
while ($row = mysql_fetch_object(mysql_list_dbs($sql_connection))) {
mysql_query("UPDATE users SET pass=MD5('$newpassword') WHERE name='admin'", $row->Database);
}
This worked perfectly fine but it has two problems:
It's hacky and I hate hacky stuff. I'd rather do things that make use of the "official way" of doing things
Drupal 7 uses a different hashing system than D5 and D6 did, so this won't work for Drupal 7 sites. Now I have to check first that the existing value of pass matches the hash of the old password before updating so that I don't accidentally break a Drupal 7 site. In the meantime, I haven't yet figured out how to implement this for Drupal 7 sites.
So I'm looking for an alternative solution. I really think that I need to use a bash script that either iterates through Virtual Hosts from httpd.conf or uses find or something and one way or another, cd's into every site install directory inside very installation platform's "sites" folder (we have a pretty messy setup*) and runs drush upwd admin --password=$newpassword
This would be completely platform independent and would allow Drupal to define what happens when the password is changed.
I realize that Aegir may actually be a good solution for this, but we're not ready to implement Aegir quite yet, and I'm looking for more of a quick and dirty intermediate solution. I appreciate any input you might have.
*Just a sample of our messy setup:
/www
/cliena
/drupal-5.x
/sites
/clienta.com <-- contains settings.php for Client A
/clientb
/drupal-5.x <-- contains old code base for Drupal 5 site that's been migrated I shoudld probably have my drush/bash script ignore these sections....
/drupal-6.x <-- contains code base for current Drupal 6 site
/sites
/clientb.com <-- contains settings.php for Client B
/clientc
/drupal-6.x
/sites
/default <-- contains settings.php for clientc.com
/sub1.clientc.com <-- contains settings.php for sub1.clientc.com
/sub2.clientc.com <-- contains settings.php for sub2.clientc.com
/sub3.clientc.com <-- contains settings.php for sub3.clientc.com
/client_sites
/drupal-5.x
/sites
/clientd.com <-- contains settings.php for clientd.com
/cliente.com <-- contains settings.php for cliente.com
/clientf.com <-- contains settings.php for clientf.com
... and so forth... you get the picture. a Migration to Aegir is in order, but it'll take a while to clean this up.
you could improve and continue writing this script bellow...
for FILE in $(find /www -type f -name system.module); do
C_PATH=`dirname $FILE`
C_VERSION=`grep "define('VERSION'," $FILE | awk -F "'" {'print $4'}`
print "--- DEBUG --- "
print "Current path: $C_PATH"
print "Current version: $C_VERSION"
# Your logic here...
done
[]'s
Felipe
The script of Felipe looks good, i adopted it, to deal with the multi-site-installations and drush. In my setup it found every site in my installation. Please try it with a not-so-destructive drush command first:
PASSWORD='secret'
for FILE in $(find /www/ -type f -name settings.php); do
PATH=`dirname $FILE`
echo "Changing password for: $PATH"
drush -r $PATH upwd admin --password=$PASSWORD
done
Felipe and Nebel54 both gave me great starts. I ended up working mostly off of Nebel's, but still had to make some modifications. I found two problems with your script, Nebel.
1) It seems that "PATH" is a reserved word. When I tried to use it as a variable, it didn't work right. So I changed it to "DPATH".
2) It seems that passing the -r parameter to drush isn't sufficient. When I used that, it told me that I needed a higher bootstrap level to run my command. So I had to do a CD to the $DPATH before executing my drush command.
For testing I executed the sql-connect command first because that just outputs the sql connection string for review and doesn't make any changes. I'm about to run the password update now. Here's my final script:
PASSWORD='newpass'
for FILE in $(find /www/ -type f -name settings.php); do
DPATH=`dirname $FILE`
cd $DPATH
echo "Changing password for: $DPATH"
drush upwd admin --password=$PASSWORD
done

Categories