[rkward-cvs] SF.net SVN: rkward: [1485] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Feb 26 20:03:53 UTC 2007


Revision: 1485
          http://svn.sourceforge.net/rkward/?rev=1485&view=rev
Author:   tfry
Date:     2007-02-26 12:03:53 -0800 (Mon, 26 Feb 2007)

Log Message:
-----------
Remove option to specify location of php support files.
Check for existence and readability of common.php when initializing the PHP backend

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/scriptbackends/phpbackend.cpp
    trunk/rkward/rkward/settings/rksettingsmodulephp.cpp
    trunk/rkward/rkward/settings/rksettingsmodulephp.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2007-02-26 19:30:06 UTC (rev 1484)
+++ trunk/rkward/ChangeLog	2007-02-26 20:03:53 UTC (rev 1485)
@@ -1,6 +1,7 @@
 - support R's mechanism for checking the C stack limits (only with R 2.3.x or greater, and not on all platforms)
 - support of all tests from moments package
 - new help related page "Trouble Shooting"
+- better error handling in PHP backend
 - fixed: depending on some buffer sizes, plugins could get stuck while generating code
 - fixed: plugin browser type="dir" would not work correctly
 - import SPSS and import CSV plugins gain option to open object for editing, automatically (checked by default)

Modified: trunk/rkward/rkward/scriptbackends/phpbackend.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/phpbackend.cpp	2007-02-26 19:30:06 UTC (rev 1484)
+++ trunk/rkward/rkward/scriptbackends/phpbackend.cpp	2007-02-26 20:03:53 UTC (rev 1485)
@@ -19,10 +19,13 @@
 #include "stdio.h"
 
 #include <qfile.h>
+#include <qfileinfo.h>
+#include <qdir.h>
 
 #include <kmessagebox.h>
 #include <klocale.h>
 
+#include "../misc/rkcommonfunctions.h"
 #include "../settings/rksettingsmodulephp.h"
 #include "../plugin/rkcomponentproperties.h"
 #include "../debug.h"
@@ -51,10 +54,19 @@
 		return false;
 	}
 
+	QDir files_path (RKCommonFunctions::getRKWardDataDir () + "phpfiles/");
+	QString common_php = files_path.filePath ("common.php", false);
+	QString php_ini = files_path.filePath ("php_ini", false);
+	if (!QFileInfo (common_php).isReadable ()) {
+		KMessageBox::error (0, i18n ("The support file \"%1\" could not be found or is not readable. Please check your installation.").arg (common_php), i18n ("PHP-Error"));
+		emit (haveError ());
+		return false;
+	}
+
 	php_process = new KProcess ();
 	*php_process << RKSettingsModulePHP::phpBin();
-	*php_process << "-c" << RKSettingsModulePHP::filesPath() + "/php.ini";	// set correct options
-	*php_process << (RKSettingsModulePHP::filesPath() + "/common.php");
+	*php_process << "-c" << php_ini;	// set correct options
+	*php_process << common_php;
 	
 	// we have to be connect at all times! Otherwise the connection will be gone for good.
 	//connect (php_process, SIGNAL (receivedStderr (KProcess *, char*, int)), this, SLOT (gotError (KProcess *, char*, int)));

Modified: trunk/rkward/rkward/settings/rksettingsmodulephp.cpp
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmodulephp.cpp	2007-02-26 19:30:06 UTC (rev 1484)
+++ trunk/rkward/rkward/settings/rksettingsmodulephp.cpp	2007-02-26 20:03:53 UTC (rev 1485)
@@ -29,7 +29,6 @@
 
 // static members
 QString RKSettingsModulePHP::php_bin;
-QString RKSettingsModulePHP::files_path;
 
 RKSettingsModulePHP::RKSettingsModulePHP (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
 	RK_TRACE (SETTINGS);
@@ -45,12 +44,6 @@
 	connect (bin_choser, SIGNAL (locationChanged ()), this, SLOT (pathChanged ()));
 	main_vbox->addWidget (bin_choser);
 
-	main_vbox->addSpacing (2*RKGlobals::spacingHint ());
-
-	files_choser = new GetFileNameWidget (this, GetFileNameWidget::ExistingDirectory, i18n ("Directory, where the PHP support files are located"), QString::null, files_path);
-	connect (files_choser, SIGNAL (locationChanged ()), this, SLOT (pathChanged ()));
-	main_vbox->addWidget (files_choser);
-
 	main_vbox->addStretch ();
 }
 
@@ -76,7 +69,6 @@
 void RKSettingsModulePHP::applyChanges () {
 	RK_TRACE (SETTINGS);
 	php_bin = bin_choser->getLocation ();
-	files_path = files_choser->getLocation ();
 }
 
 void RKSettingsModulePHP::save (KConfig *config) {
@@ -89,7 +81,6 @@
 
 	config->setGroup ("PHP Settings");
 	config->writeEntry ("PHP binary", php_bin);
-	config->writeEntry ("support files dir", files_path);
 }
 
 void RKSettingsModulePHP::loadSettings (KConfig *config) {
@@ -97,7 +88,6 @@
 
 	config->setGroup ("PHP Settings");
 	php_bin = config->readEntry ("PHP binary", "/usr/bin/php");
-	files_path = config->readEntry ("support files dir", RKCommonFunctions::getRKWardDataDir () + "phpfiles/");
 }
 
 #include "rksettingsmodulephp.moc"

Modified: trunk/rkward/rkward/settings/rksettingsmodulephp.h
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmodulephp.h	2007-02-26 19:30:06 UTC (rev 1484)
+++ trunk/rkward/rkward/settings/rksettingsmodulephp.h	2007-02-26 20:03:53 UTC (rev 1485)
@@ -44,16 +44,12 @@
 
 /// returns the filename of the php-binary
 	static QString &phpBin () { return php_bin; };
-/// returns the directory-name where supporting files such as the "common.php" reside
-	static QString &filesPath () { return files_path; };
 public slots:
 	void pathChanged ();
 private:
 	GetFileNameWidget *bin_choser;
-	GetFileNameWidget *files_choser;
 
 	static QString php_bin;
-	static QString files_path;
 };
 
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list