Symfony Shared Library Upgrade - symfony1

I have a symfony version 1.0.16 application that I want to upgrade to symfony 1.4. Symfony is currently installed as a shared library on my server. How can I convert from a server wide shared library to a domain specific symfony library?

I work every day on Symfony projects and one of the best practice i've adopted is:
Always embbed the symfony vendor libraries inside the applicacion (its the recommended by symfony when having non related projects hosted on same server).
So, steps to take in order to change from wide to local:
Create a vendor folder on $sf_root/lib/
Download and uncompress a symfony version inside $sf_root/lib/vendor/symfony folder
replace the symfony script on $sf_root/ with the one on ($sf_root/lib/vendor/symfony/data/bin/symfony)
Modify the ProjectConfiguration.class.php on config to start using the lib/vendor/symfony libraries. It should look something like this:
require_once dirname(__FILE__).'/../lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();
class ProjectConfiguration extends sfProjectConfiguration{
.....}
Rebuild all classes
Verify your code. Plugins not always work with every symfony versions. Also if you created administrator modules (like the ones generated by propel), check if the configuration.yml it's still consistent.
Also this could be helpful (its a different version but could give ideas if something breaks) Upgrade symfony project

Related

NopCommerce Plugin Localization

I am working on a NopCommerce website and have quite a bit of site-wide customization so I have created a plugin to handle it all but not sure on how to handle the localization. I see there are a couple of ways of updating the Localization strings, one way I have found is in the Plugin's Install() method:
this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalStandard.Fields.AdditionalFee", "Additional fee");
This looks like it only adds new resource strings for the plugin, is there a similar way to update the other resources via the Install() method like:
Admin.Catalog.Products.List.DownloadPDF
I found that there is a way to export the entire language to a language_pack.xml file, would it be better to just create an entire language pack instead? Is there a way to add a new language pack from the plugins Install() method?
I guess I could simply open the language_pack.xml file and add each resource found using the AddOrUpdatePluginLocaleResource, I was hoping that there was a built-in way of doing this using NopCommernce functionality.
Thanks!
As #Raphael suggested in a comment, provide a language pack along with plugin file to the end users, and give an option to upload required resource file within your plugin configuration page.
As per as I know, there is no inbuilt way to add language pack on plugin installation, but you can do some code on plugin install method to find language pack file(s) from plugin folder and install it, not quite sure, you can take reference of inbuilt methods.

Where is the default login page for the spring security core plugin?

I have installed the spring security core plugin. I need to modify the login page to look like my existing website. I have searched the entire project and cannot find it. I am running grails 2.4 and spring-security-core:2.0-RC5. Where can this pesky little file be? Can someone who is not a complete greenhorn help a fellow out?
As #Abs points out, the file is at target/work/plugins/spring-security-core-2.0-RC5/grails-app/views/login/auth.gsp but you shouldn't edit plugin files. Other developers on your team won't have access to the modified files and if you delete the target directory you'll lose your changes since the target directory is only a temporary work location.
Instead, copy the file to the same relative location in your application and make changes there. Create grails-app/views/login and copy the file there and make whatever changes you want.
This technique works for most plugin files, not just GSPs. The compilation order and classpath are configured such that application files and classes override plugin files if they're in the same location/package.
You can find the default login page here
targt->work->plugins->spring-security-core-2.0-RC5->grails-app->views->login>auth.gsp

How to deploy nopCommerce 3.5 to new server from source?

I have nopCommerce 3.5 source code with numerous customizations and plugins that needs to be moved to a new server. I restored the database backup and have the source on the new server. What other steps are needed to ensure proper deployment to the new development server?
For the latest NopCommerce version, there is a short instructions file for publishing your code to the server here: http://nopcommerce.codeplex.com/SourceControl/latest#src/Deploying.Readme.txt
I haven't personally tried that method because I've used NopCommerce up to version 3.10, which had an alternative deploying method. (see below)
For Nop 3.50 method, you'd also need to set database credentials and database name into AppData\Settings.txt file.
In case you will find it useful, I'll also present my usual routine when deploying a nopCommerce (<= 3.10) website is the following:
Create a folder for NopCommerce (obviously :)
Create an IIS website in IIS Manager with .NET v40-enabled application pool.
Enable "32-bit application support" on the application pool (in advanced properties). I have some plugins that rely on 32-bit DLLs. If you don't have such dependencies, you might not need to enable this option.
Set proper permissions on the folder I created so NopCommerce (more exactly, the IIS process for the website) can successfully read and write data. In my IIS setup, I need to give "Modify" permissions on the folder to IUSR and IIS_IUSRS.
Copy the built NopCommerce to the folder.
Here is a batch script I used for creating an archive of necessary files (after re-building the entire solution): https://gist.github.com/dan-mirescu/c14cc72e3f8ecca988b7
The script also includes suggestions about what to do next. Please check them out.
And of course, you also need to have the database ready:
Restore database and optionally create a SQL user which has 'owner' access to it.
Update AppData/Settings.txt with the new database settings.
I hope this helps.

How can I load code from another Dart package, known only at runtime?

I am building a Dart application. It needs to load code from a third-party package, which is only known at runtime. My application needs to:
auto-discover the dependency
load a library from that dependency
interact with the dependency
Ideally, I do not want to require that my users specify the third-party dependency. The application should auto-discover the dependency.
For example, a workflow could be something like this:
User installs my app (pub global activate my_app)
User installs a "plugin" (pub global activate plugin_for_my_app)
User runs my app (my_app)
The app auto-discovers that plugin_for_my_app exists.
The app loads the plugin (via spawnUri perhaps?)
The app calls into the plugin
Requirements:
Must run from the command-line.
Must work on Windows, Mac, Linux.
Should (but doesn't have to) run when compiled to JavaScript.
pub run support is optional (pub run makes it tricky, because it rewrites your import URIs, so it's not a requirement)
What's the best way to do this?
This package https://pub.dartlang.org/packages/plugins seems to do exactly what you want (haven't used it myself yet though) by loading plugins into isolates.
This is not directly answering the question (CL tools as requested), but I use plugins in the browser and wanted to share my "pattern".
My web application imports includes.dart which is a dynamically generated file that imports all .dart files found in a specified directory. The file gets (re-)generated at app startup by the backend, just before serving the files to the browser. The found .dart files implement a public api (eg. init() and run()) so that the main application can call their code. The plugin code are not loaded into separate isolates but are executed in the same isolate as the main app which gives the benefit of plugins sharing the same heap and you're able to access the plugin code directly. This solution also assumes the plugins resolve their own dependencies.
This setup works fairly well for my use case. However, as there's no real dynamic code reloading in Dart (yet, I hope. see https://code.google.com/p/dart/issues/detail?id=10530), there's always a refresh step needed to load the new code.
In the plugins package, currently, there is no way to resolve dependencies through pub. When I originally designed the API it was assumed that the dependencies were already retrieved through pub get. With that said, plugin discovery on the file system is simple.
As you can see in the example in the README, loading plugins was as simple as new PluginManager().loadAll(String directory) which would automatically discover all plugins inside the directory and load them. This solution is ideal if all plugins are to be in one folder.
It is possible to do individual plugin directory loading as well, provided it follows the plugin directory structure. Using a PluginLoader you can load in a directory that contains the necessary files for a plugin to run properly. It is not necessary to call load() since the PluginManager will take care of calling in load for you.
A simplified way of loading a plugin
Instantiate the PluginManager.
PluginManager pm = new PluginManager();
Determine the plugin you want loaded. The plugins library will automatically
determine the pub cache directory. As per the documentation of pub, the PUB_CACHE environment variable is also supported.
Load in the plugin. A Future is returned with a Plugin object that provides basic information about the plugin. The plugin requires a pubspec.yaml with a name, a packages directory, and a bin/main.dart source file. However we are loading from the pub cache, so we do not need to worry about the setup of the plugin, the only requirement is the package from the pub cache supports the plugins package.
pm.loadFromCache("test-1.0.0").then((Plugin plugin) {
print("Plugin loaded!");
handle();
});
After all the plugins you desire to be loaded are initialized, the manager can now listen for requests properly. Simply use the listener to 'see' the incoming data.
The plugin side
The plugin simply uses a receiver as provided by the plugins API.
void main(List<String> args, SendPort port) {
Receiver rec = new Receiver(port);
rec.listen((Map<dynamic, dynamic> data) {
print("Received data: $data");
});
}
I wrapped the plugins package with a bit of sugar to provide some extra things like declarative RPC. It's very flexible, and samrg472 (the author of plugins.dart) is a good friend, so I have asked him to comment as well.
https://github.com/PolymorphicBot/PolymorphicBot/blob/master/lib/src/core/plugins/handler.dart

May I use sf_sandbox directly as my symfony project?

As sf_sandbox has set up the symfony environment, why not develop in the sandbox directly and then upload on to server? What are the disadvantages of sandbox compared with configuring manually?
I think there is no drawback in following this approach. sf_sandbox is a pre-configured symfony project. One of the pluses is that is saves you time in creating your project and initializing an empty application (by default this is called frontend).
It's more a matter of taste rather than a matter of right or wrong. It's up to you!
Note: If you follow this approach you have to make some initial configuration (steps 1,2,3 would be done anyway if you started your project from scratch):
Rename the project
Change the config/properties.ini file
Change the config/databases.yml file (by default sf_sandbox uses sqlite database)
Remove the data/sandbox.db database file

Resources