How to add a single page from a package directory manually???

Permalink
If i have an installed package which uses single pages and i accidentally deleted one in the sitemap, how do i reinstall that single page?

I have tried every path combination i can think off. I would have thought it would packages/package_name/single_pages/dashboard/page_name/ but this doesnt work.

pixelfish
 
codingpenguins replied on at Permalink Reply
To add a single page by itself, you must place it in the main single_page folder.

1) With that said. I have never done that before, but you could try to put it in the single_page folder with the directory: /single_pages/dashboard/page_name. If it depends on a controller, you might have to move that as well. This is not the prettiest, but I done it a couple of times and it works, but I never done it with a package.

2) You could also remove the package and add it back...

3) You could also change the database so that it would find the single. I did this once, and I ended it with the page /dashboard/page_name/sub_page_name to /dashboard/page_name/sub_page_name1 - Dont know where the 1 came from, but it works.
jordanlev replied on at Permalink Reply
jordanlev
As long as you didn't delete actual files from the package, I think you can just go to Dashboard -> Pages and Themes -> Single Page, scroll down to the bottom of the list, and add the single_page name in the box at the bottom. It won't have the package name in its path at all, just put this:

dashboard/page_name

Although on second thought that might not work because C5 might not look in the package directory for pages that are installed that way. If that's the case, you need to go into the database (using phpMyAdmin, for example), find the record for that single_page you added, and set its pkgID field to the package ID (which you'll have to look up in the Packages table).
francoiscote replied on at Permalink Reply
francoiscote
I just had the same problem, where a couple of single pages needed to be reinstalled. Deleting/re-adding the package was not a option for me, because I didn't want to loose pages/blocks and other database tables with data in them (on a live website).

I used the package upgrade() method instead, where I first verify if my missing pages are indeed missing, and then add them back

public function upgrade() {
      Loader::model('single_page');
      Loader::model('package');
      $pkg = Package::getByHandle($this->getPackageHandle());
      $a = Page::getByPath("/dashboard/intervenants");
      if ($a->isError() && $a->getError() == COLLECTION_NOT_FOUND) {
         $spa = SinglePage::add('dashboard/intervenants', $pkg);
         $spa->update(array('cName' => 'Intervenants', 'cDescription'=>'Statistiques Intervenants'));
      }
      $b = Page::getByPath("/dashboard/intervenants/search");
      if ($b->isError() && $b->getError() == COLLECTION_NOT_FOUND) {
           $spb = SinglePage::add('dashboard/intervenants/search', $pkg);
         $spb->update(array('cName' => 'Intervenants'));
      }
   }


In order to be able to upgrade a package, just change your version protected $pkgVersion property:
protected $pkgVersion = '1.7';


then the package will appear has been 'ready to update' in the Add a functionality section.

I hope that solution can help you.
BinaryFold4 replied on at Permalink Reply
BinaryFold4
This is great, just what I needed!
java9 replied on at Permalink Reply
Hello,

Could you please take a look at what I wrote on a another thread:

My problem:

I'm adding a single_page on top of an existing package. I've come across advice that shows how to (re)write custom upgrade method for adding a single_page.

But, I'm not sure how to run that method? This is third-party package and the way I already tried didn't work for me.

What I did was:
1) changed package version to trigger "Update available" in the Dashboard
2) That worked - the message really showed up but upon clicking it, it took me to the C5 marketplace.

I don't need that - I just want to be able to call upgrade() method so it can execute and create the new single_page
francoiscote replied on at Permalink Reply
francoiscote
What version of Concrete5 are you running ?

This is a bug I remember having. Trying to update any package would take me to the Marketplace instead of updating the package. I think I got this bug when I first upgraded to 5.5 and it got fixed on 5.5.1 or something like that.
java9 replied on at Permalink Reply
I decided to take a risk and proceed with connecting to the Marketplace (before that, C5 only displayed a button to connect). Prior to connecting, I tried to locate the package itself on the marketplace - I didn't find it so I concluded my client must have had it made specifically for him by some company.

So, I connected to the Marketplace, message appeared that I was connected. Then, I reloaded my packages list and clicked Apply update for the package in question. Everything went fine, upgrade() method was executed.
francoiscote replied on at Permalink Reply
francoiscote
good!
java9 replied on at Permalink Reply
Anyway, thanks for replying.

For anyone that might stumble upon this thread and have issues with adding single pages to an existing package - I think it's worth mentioning that I was able to add my single page but it was empty even though I took the contents of another single page.

Here's what I did after the page was added:

1. created new controller AND new single page (placed in their respective directories).
2. took contents from existing controller and single pages and pasted into my new files. Obviously, I needed to change controller name.
3. I visited the page but it was blank (only header and footer were there, as they're called automatically on every single page)
4. I thought to myself: it might be that those pages must exist prior to the process of adding. I removed the page, and re-run the process. Now the page was showing, and was identical to the other single page I took the contents from.
francoiscote replied on at Permalink Reply
francoiscote
yep, have a look at the release notes from 5.5.1, the last bug fix:

http://www.concrete5.org/documentation/background/version_history/5...
"Updating local packages forced you to connect to the community. This is now no longer the case."

so I would suspect you are running 5.5 ? upgrade and that would fix your problem.
java9 replied on at Permalink Reply
Yes, you're right, the version I'm using is 5.5.0
I'd love to upgrade it but I don't want to as I'm afraid to break my client's app. As I said above, after connecting, my local upgrade process went just fine.