Is it possible to recover deleted folder in plone 4.1? - plone

How could I recover deleted folder in plone 4.1?

If you haven't yet packed away the transaction that deleted the folder, you can recover the folder.
First, use the "Undo" tab on the parent folder, in the ZMI. It could that doesn't work, too many other things on the system have changed (usually the catalog), for all the changes to be rolled back effectively.
Next step is a little more cumbersome and involved. What you then have to do is open the Object Database (ZODB) with a wrapper that will show you the state of the database at a given point in history. Doing this requires some manual editing of your Zope server configuration. I've written up the steps in a blog post but those steps are a little outdated.
In a modern Plone buildout, you need to add the zc.beforestorage egg to your buildout, and you need to switch the enable-product-installation setting of Zope to False; using the beforestorage wrapper makes your database read-only and the product installation code would try to commit to database, resulting in a failure to start:
[instance]
eggs +=
zc.beforestorage
zope-conf-additional +=
enable-product-installation False
After rebuilding the buildout, you need to open the zope.conf file associated with your instance. If you normally start your server with bin/instance, then that file is located in parts/instance/etc/zope.conf; the script in bin/ used matches the part name (instance in this example).
Locate the part where it defines the ZODB main database:
<zodb_db main>
# Main database
cache-size 10000
# Blob-enabled FileStorage database
<blobstorage>
blob-dir /path/to/var/blobstorage
<filestorage>
path /path/to/var/filestorage/Data.fs
</filestorage>
</blobstorage>
mount-point /
</zodb_db>
You need to add the beforestorage wrapper into that declaration:
<zodb_db main>
# Main database
cache-size 10000
%import zc.beforestorage
<before>
before 2012-12-01T12:00:00
# Blob-enabled FileStorage database
<blobstorage>
blob-dir /path/to/var/blobstorage
<filestorage>
path /path/to/var/filestorage/Data.fs
</filestorage>
</blobstorage>
</before>
mount-point /
</zodb_db>
Note the before <iso timestamp> line in there; when you start your instance, the site will be presented as it was at that timestamp. Choose one close to when you deleted the folder. Now you can export it (again using the ZMI) to a .zexp file. Undo the changes to your zope.conf file, restart, and import the recovered folder.

Yes, it's possible using the Zope Management Interface's "Undo" tab on the folder in question. This will roll back the database transaction in which you deleted the folder, and works most effectively if you have just deleted the folder. Additional information is at: https://plone.org/documentation/kb/using-the-zope-undo-system-to-roll-back

Related

Unable to create the workspace '' due to a mapping conflict

I am using TFS 2013 Build Server.
Getting the following Error
Exception Message: Unable to create the workspace '' due to a mapping conflict. You may need to manually delete an old workspace. You can get a list of workspaces on a computer with the command 'tf workspaces /computer:%COMPUTERNAME%'.
Details: The path F:\GDC\Bin is already mapped in workspace ''. (type MappingConflictException)
I have multiple build Definition which refers to common binary folder
Source Setting for Build definition BD1
Source Control Folder Build Agentfolder
$/Common F:\GDC\Bin
$/Project1 $(SourceDir)
Source Setting for Build defination BD2
Source Control Folder Build Agentfolder
$/Common F:\GDC\Bin
$/Project2 $(SourceDir)
Source Setting for Build definition BD3
Source Control Folder Build Agentfolder
$/Common F:\GDC\Bin
$/Project3 $(SourceDir)
This occurs (as the error suggests) when you have a workspace clash on the build server. Workspaces are saved as configuration values in the TFS database so clashes are possibly caused by:
you have created a new build definition with the same name as a previous build definition.
some part of your workspace name (or an artifact within your project) is over 260 chars
build definition is not using $(sourcedir) macro in System Settings tab
More details are explained in this article
Work-around:
Rename your build definition to something unique.
Here is how I did it:
First, tried to list the workspaces on the server in question. I tried through both Visual Studio UI and command prompt: tf workspaces /computer:. The workspace that is mentioned in the Exception message did not show up in the list.
Downloaded and installed Team Foundation Sidekicks 2015 from http://www.attrice.info/downloads/
When the app installed, opened and connected to tfs server.
Selected the computer name from the dropdown, cleared the Owner name (VERY IMPORTANT!) dropdown from the dropdown and changed Last access date to a date few years ago.
Clicked Search button. The list of workspaces appeared. This time I could see the workspace that was mentioned in the Exception message.
Selected the workspace that is mentioned in the Exception message and clicked Delete button.
It appears that when I login to the build server and ask for the workspaces list, tfs only shows me the workspaces of which I am the owner. The temporary workspaces that build process creates were not assigned to me and therefore I could not see them. Team Foundation Sidekicks 2015 did show me all of the workspaces.
Note: I used TFS2015 in this exercise.
So you have a Workspace conflict.
The easiest way to explain to fix this is to delete your workspaces and make them over again.
You'll need to use the TF tool.
TF /workspace /delete....
There is a TFS sidekicks tool that should be able to do this for you with a GUI.
http://www.attrice.info/cm/tfs/
The reason was (for me) that I have cloned the build definitions. So every "Build Agend Folder" in Source Settings points to the same target folder.
Solution was to change the Build Agent Folder to something special for each build.
e.g. $(SourceDir)\project1
$(SourceDir)\project2 etc
I had the same problem. My solution was that in Edit Build Definition > Source Settings, a Build Agent Folder was not prefixed with $(SourceDir), but instead the full path on my local machine.
I changed the path to be prefixed with $(SourceDir, and my problem was solved.
I have rename build definition name and it started working.

Can I run code at Alfresco startup?

I have an Alfresco module that I would like to have do some cleanup when a new version of it is installed.
In the current situation, an older version of the module created a folder node with custom properties at the root of the repository. We've since decided to have multiple such nodes, and none of them at that location. I'd like to put into the next version of the module code that would run at Alfresco startup, check for the existence of the old node, copy its properties into the appropriate new nodes, and delete the old node.
Is such a thing possible? I've looked at the Bootstrap configuration file, but that appears to only allow one to add things to the repository, not modify or delete them.
My suggestion is that you write a patch. That is a class that implements
org.alfresco.repo.admin.patch.AbstractPatch
Then you can do pretty much anything you want on bootstrap (except executing searches against solr since it wont be available).
Add some spring configuration, take a look at the file patch-services-context.xml for inspiration.
Yes you can do that, probably you missed the correct place in the documentation about that:
If you open Import Strategy you'll find a section Per BootstrapView, you should be using something like REPLACE_EXISTING or UPDATE_EXISTING for your ACP packaged content (if you're using ACPs as your bootstrap importing strategy).
Here is a more detailed description of the UUID Bindings values.
Hope that helps.
You can use patches.
When alfresco server starts it applies patches and executes database updates etc.
Definition :
A patch is a piece of Java code that executes once when Alfresco
Content Services starts. Custom patches can be implemented.
Documentation Link

which files should be added to Souce Control (Service Reference)

When i added service reference to my .Net project (right click->Add Service Reference), VS created a folder with the Service name and created bunch of files (listed below). I am not sure which files should be added to the source control so that next time when i upgrade the service reference, i dont end up deleting some files and adding new files. List of files that VS created in the service folder are as below:
ConfigurationService.disco
ConfigurationService.wsdl
ConfigurationService.xsd
ConfigurationService1.xsd
ConfigurationService2.xsd
ConfigurationService1.wsdl
ConfigurationService3.xsd
ConfigurationService4.xsd
configuration91.svcinfo
configuration.svcinfo
Reference.svcmap
Reference.cs
abc.datasource
def.datasource
ghi.datasource
jkl.datasource
mno.datasource
pqr.datasource
usually we add the whole folder with all its files, you can safely do that.
user specific files are not created in that subfolder.
Consider that when you will update the reference some files will be edited and others will not be touched. If some are fully regenerated TFS or the source control system you are using will get the changes, not the deletion and re-add as another file with same name; at least I would expect so and never seen anything different happening.

MSBuild/WebDeploy - How to prevent it from deleting a folder and its contents

We're using TeamCity to automate MSBuild to use WebDeploy to push our application to our various servers.
For the most part, we've got this working, and great. One snag, though: we've got a folder that holds uploads that we don't want to have deleted during the publication.
How do I tell WebDeploy, "I know that folder's not in the compiled application. Ignore it. Just leave it alone."
If you're using the dirPath, filePath, or contentPath providers, you can specify the DoNotDelete rule to block deletions of files on the destination computer that do not exist on the source. The syntax to add to the command line would be -enableRule:DoNotDelete. For more information, see the provider articles mentioned and Web Deploy Rules.

The workspace with the iOS project and related a static library project

I am fighting with Xcode 4 workspaces. Currently Xcode 4 wins. Thus, my situation:
I have the workspace with the iOS app project. There is also static library project iOS app depends on in the this workspace.
Solution #1
I try to configure like this:
the app project:
add to target's Build Phases > Link Binary With Library a product (libmystaticlib.a);
set USER_HEADER_SEARCH_PATHS to $(TARGET_BUILD_DIR)/usr/local/include $(DSTROOT)/usr/local/include;
the static library project:
add some header files to target's Build Phases > Copy Headers > Public;
set SKIP_INSTALL to YES.
And important thing: both projects must have configurations named the same. Otherwise, if I have, e.g., configuration named Distribution (Ad Hoc) for the app and Release for the static library, Xcode can't link the app with the library.
With this configuration archiving results to an archive with the application and public headers from static library projects. Of course, I am not able to share *.ipa in this case. :(
Solution #2
I have also tried another configuration:
Xcode preferences:
set source tree for the static library, e.g, ADDITIONS_PROJECT;
the app project:
add to target's Build Phases > Link Binary With Library a product (libmystaticlib.a);
set USER_HEADER_SEARCH_PATHS to $(ADDITIONS_PROJECT)/**;
the static library project:
don't add any header files to Public!;
set SKIP_INSTALL to YES.
I still need to care about configuration names for both projects. But in result I can build and archive successfully. In the result I get archive and I can share *.ipa.
I don't like the second solutions, because in this case I don't get any real advantage of the Xcode 4 workspace. The same effect I can add get, if I add the static lib project inside the app project. Therefore, I think something is wrong with my solution.
Any suggestion how better to link a static libraries?
I also found a solution that works with build and with archive.
In your static library set the Public Headers Folder Path to ../../Headers/YourLib
In your app config set the Header Search Paths to $(BUILT_PRODUCTS_DIR)/../../Headers
In your app you will be able to code #import <YourLib/YourFile.h>
Don't forget the Skip Install = YES option in your static lib.
We've found an answer, finally. Well, kind of. The problem occurred because Xcode 4 places public headers into InstallationBuildProductsLocation folder during build for archive. Apparently, when archiving it sees the headers and tries to put them into archive as well. Changing Public Headers Folder Path of the lib to somewhere outside of InstallationBuildProductsLocation, for example, to $(DSTROOT)/../public_folders and adding this path to Header Search Path solve the problem.
This solution doesn't look very elegant, but for us it seems to be the only option. May be you'll find this useful.
Here is a solution a get from Apple DTS. I don't like it, because it is suggests to use absolute path. But I still publish it here, maybe someone feels it is right for him.
How to set up the static library:
Add a build configuration named "Archive" by copying the Release Configuration.
Move your headers to the Project group of the Copy Headers build phase.
Set the Per-configuration Build Products Path of the "Archive" configuration to $(BUILD_DIR)/MyLibBuildDir. Xcode will create the MyLibBuildDir folder inside the BuildProductsPath, then add your static library into that folder. You can use "MyLibBuildDir" or provide another name for the above folder.
Set Skip Install to YES for all configurations.
Set Installation Directory of "Archive" to $(TARGET_TEMP_DIR)/UninstalledProducts.
Edit its scheme, set the Build Configuration of its Archive action to "Archive."
How to set up the project linking against the library:
Add a build configuration named "Archive" by copying the Release Configuration.
Set the Library Search Paths of "Archive" to $(BUILD_DIR)/MyLibBuildDir.
Set the User Header Search Paths to the recursive absolute path of your root of your workspace directory for all configurations.
Set Always Search User Paths of "Archive" to YES.
Set Skip_Install to NO for all configurations.
Edit its scheme, set the Build Configuration of its Archive action to "Archive."
I was not real happy with any of the other solutions that were provided, so I found another solution that I prefer. Rather than having to use relevant paths to put the /usr/local/include folder outside of the installation directory, I added a pre-action to the Archive step in my scheme. In the pre-action I provided a script that removed the usr directory prior to archiving.
rm -r "$OBJROOT/ArchiveIntermediates/MyAppName/InstallationBuildProductsLocation/usr"
This removes the usr directory before archiving so that it does not end up in the bundle and cause Xcode to think it has multiple modules.
so far I also struggled with the same problem, but did come to a solution with a minimal tradeoff:
This requires Dervied Data to be your Build Location.
I set the Public Headers Folder path to ../usr/local/include
This will ensure, that the headers will not be placed into the archive.
For the app, I set the Header Search Path to:
$(OBJROOT)/usr/local/include
$(SYMROOT)/usr/local/include
There are 2 entries necessary since the paths slightly change when building an archive and I haven't figured out how to describe it with only one variable.
The nice thing here is, that it doesn't break code sense. So except for having 2 entries rather than one, this works perfectly fine.
I'm struggling with the same problem at the moment. I didn't progress much farther than you. I can only add that in the second solution you can drag headers you need to use from the library to the app project, instead of setting ADDITIONS_PROJECT and USER_HEADER_SEARCH_PATH. This will make them visible in app project. Value of SKIP_INSTALL flag doesn't matter in this case.
Still, this solution isn't going to work for me, because I'm moving rather big project, with dozens of libraries, from Xcode 3 to Xcode 4, and it means really a lot of drag and drop to make my project build and archive correctly. Please let us know if you find any better way out of this situation.
I could use Core Plot as a static library and workspace sibling, with two build configurations:
Release:
in project, Header Search Path: "$(BUILT_PRODUCTS_DIR)"
in CorePlot-CocoaTouch, Public Headers Folder Path: /usr/local/include
AdHoc (build configuration for "Archive" step in Scheme, produces a shareable .ipa):
in project, Header Search Path: "$(BUILT_PRODUCTS_DIR)"/../../public_folders/**
in CorePlot-CocoaTouch, Public Headers Folder Path: ../../public_folders
Hope it will help someone to not waste a day on this.

Resources